int x = 1; while(x<100){ DecimalFormat df = new DecimalFormat("000"); String xs = df.format(x); System.out.println(xs); x++; }
将 1 格式化为 001