String.format("%03d", i)主要实现若是一个数字为超过3位,则会在其前面补零以到达规定的位数,其中0是被填充到缺省位的数字,3表明规定数字的总位数 d表明是整型。3d
int x = 1;orm
String xx = String.format("%03d", x);form
System.out.println(xx);数字
结果是001