How do I represent numbers in the format
001 = 1 002 = 2 003 = 3 010 = 10 020 = 20
The number of digits is always 3.
You can use something like this
DecimalFormat decimalFormat = new DecimalFormat(); decimalFormat.setMinimumIntegerDigits(3); System.err.println(decimalFormat.format(2));