How to add zeros to the left of a numeric String in Java?

I need to add zeros to the left of a number until it gets six digits.

Ex. If the number is 5, it should be formatted as 000005.

Can someone please let me know how to achieve this in Java?

Comments

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories