Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
How do you left pad an int with zeros when converting to a String in java?
int
String
I'm basically looking to pad out integers up to 99999999 with leading zeros (e.g. 1 = "0001"0001).
9999
0001
I'm basically looking to pad out integers up to 9999 with leading zeros (e.g. 1 = "0001").
I'm basically looking to pad out integers up to 9999 with leading zeros (e.g. 1 = 0001).
How do you left pad an intint with zeros in java when converting to a stringString in java?
I'm basically looking to pad out integers up to 9999 with the leading zeros (e.g. 1 = "0001").
How do you left pad an int with zeros in java when converting to a string?