for(int i = 1i<张数i++) {
int numlength = ((Integer)i).toString().length()
}
简单实现代码如下:public class Test{
public static void main(String[] args)
{
for (int i=1i<999999 i++ ){//for循环
String code=i+""
int leng=(code.trim()).length() //定义长度
if(leng==1){
code="00000"+i
}else if(leng==2){
code="0000"+i
}else if(leng==3){
code="000"+i
}else if(leng==4){
code="00"+i
}else if(leng==5){
code="0"+i
}
System.out.println("code:"+code)
}
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)