Hello.
I have this problem.
I have numbers with 1, 2 or 3 digits (always integers).
I want to format those numbers with 2 leading zeros.
For example, if the number is 2 (1 digit), I want to obtain 001.
If the number is 39 (2 digits) I want to obtain 0039.
Is there an easy way to obtain this using the DecimalFormat class?
Thank you in advance.
P.S.: Actually I'm using the
pattern "00000" but it doesn't always work, because if the number has digits < 3, the leading zeros are more than 2.