If you want to output integers such that they always have leading zeros, use String.format with a zero before the number of digits in the format string, for example:
int i = 3;
String s = String.format("%03d", i);
System.out.println(s);
Gives the output:
003