int 9 转换成 String 0009 int 99 转换成 String 0099 int 999 转换成 String 0999
public class Test{ public static void main(String[] args){ int x=99; String xs=String.valueOf(x); String [] ss = {"0000","000","00","0"}; xs = ss[xs.length] + xs; System.out.print(xs); } }