I need to format numbers in a way that they should be preceded with zeros to contain 5 digits.
I don't get how to create patterns for java formatter.
I tried %4d
but it doesn't adds zeros.
%05d
should do it I believe
int a=123;
System.out.println(String.format("%05d",a));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With