Convert single digit to double digit

Hi
  I want to convert single digit integer to double digit. Is there any simple method?
I want output like
 0  -00
1- 01
11- 11

Thanks
Karan
LVL 11
ManishLeadAsked:
Who is Participating?
 
sciuriwareCommented:
String.format("%02d", i);  // Where 'i' is the integer.

;JOOP!
0
 
ManishLeadAuthor Commented:
double digit string will do.
0
 
sciuriwareCommented:
Likewise: output.printf("%02d", i);

Assuming 'output' is a PrintWriter object or such.

;JOOP!
0
 
ManishLeadAuthor Commented:
Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.