/**
* 测试
* @param args
*/
public static void main(String[] args) {
String oldNum = "00001";
for (int i = 1; i <= 10; i++) {
int a = Integer.parseInt(oldNum)+i;
// %nd 输出的整型宽度至少为n位,右对齐,%8d即宽度至少为8位,位数大于8则输出实际位数,0表示用0补齐
oldNum = String.format("%05d",i);
System.out.println(oldNum);
}
}
评论区