This question already has an answer here:
- How can I pad a String in Java? 27 answers
I've seen similar questions here and here.
But am not getting how to left pad a String with Zero.
input: "129018" output: "0000129018"
The total output length should be TEN.
The solution by Satish is very good among the expected answers. I wanted to make it more general by adding variable n to format string instead of 10 chars.
This will work in most situations