Originally posted by D diller:
... while keeping it as an integer (I need to manipulate the variable later easily), or will I have to convert it to a String?
It sounds like you are confused about data types and what they mean exactly.
An integer is just a number - nothing more, nothing less. It does not have a "format". So, an integer does not have leading zeroes. Whenever you display an integer on screen, you are converting it to text - ASCII characters, or characters in a different encoding, that the computer knows how to display.
Also, variables in
Java have a fixed type. A variable's type cannot be changed from int to String.
Normally, if you print an integer with for example System.out.println() without thinking how you want it formatted, the computer will format it as a sequence of decimal digits and those are printed to the screen.
In some cases, like yours, you want the number to be printed with a specific format. So then you need to use classes and methods that allow you to specify the format. You can use System.out.printf(), which is the shortest way to do this, or you could use class java.text.DecimalFormat.