Format integer numbers with leading zeroes in Java
Description
The following code shows how to format integer numbers with leading zeroes.
Example
/*from ww w . java 2 s .co m*/
import java.text.DecimalFormat;
public class Main {
public static void main(String args[]) {
DecimalFormat df = new DecimalFormat("0000000000000000");
String z = df.format(123456);
System.out.println(z);
}
}
The code above generates the following result.