I thought there was a function in Java which pads a string for you, so that string is certain length. I could not find the function but realized that there is a easier and simpler solution, a “while loop”.
e.g.
while ( string.length() < 8){
string = “0″ + string;
}
I am sure there is a better way to do this but if performance is not your concern then this is perfect.
Related posts:
![Reblog this post [with Zemanta]](http://img.zemanta.com/reblog_e.png?x-id=224516f0-c9ce-4cad-95fc-3719a5f24170)

