How can I store an integer in two digit format in Java? Like can I set
int a=01;
and print it as 01? Also, not only printing,
01
// below, %02d says to java that I want my integer to be formatted as a 2 digit representation String temp = String.format("%02d", yourIntValue); // and if you want to do the reverse int i = Integer.parse(temp); // 2 -> 02 (for example)