formatting string

how do i store an int say value 6 and store it in as a string to hold "00006" in the string. thanks.
[121 byte] By [echizena] at [2007-10-3 6:10:59]
# 1
Do you mean something like this?NumberFormat nf = NumberFormat.getIntegerInstance();nf.setMinimumIntegerDigits(5);String s = nf.format(x);
cnaanta at 2007-7-15 0:54:30 > top of Java-index,Other Topics,Algorithms...
# 2

> Do you mean something like this?

>

> NumberFormat nf = NumberFormat.getIntegerInstance();

> nf.setMinimumIntegerDigits(5);

> String s = nf.format(x);

I'm not sure if that'll work...

Try this:java.text.NumberFormat formatter = new java.text.DecimalFormat("00000");

int number = 6;

System.out.println(number+" formatted = "+formatter.format(number));

prometheuzza at 2007-7-15 0:54:30 > top of Java-index,Other Topics,Algorithms...
# 3
how do i get rid of the , ?
echizena at 2007-7-15 0:54:30 > top of Java-index,Other Topics,Algorithms...
# 4
oh well thanks both ... numberformat does the job =) thanksssss
echizena at 2007-7-15 0:54:30 > top of Java-index,Other Topics,Algorithms...