I want to prepend zeros to an int if its string equivalent length is less than 6. Similar to String.format. Example:
int e = 21;
System.out.println(String.format("%06d", e)); //000021
int e = 3564;
System.out.println(String.format("%06d", e)); //003564
What I need is for the above inputs 210000
and 356400
the zeros prepended at the end. Is there something already implemented which will do the job or do i need to code it by my self? If so how to deal with variable length?