import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Test1 {
public static void main(String[] args) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
System.out.println("输入:");
String str = null;
try {
str = br.readLine();
} catch (IOException e) {
System.out.println("I/O错误!");
}
boolean bl = true; //存放是否全为数字
char[] c = str.toCharArray(); //把输入的字符串转成字符数组
for(int i=0;i<c.length;i++){
if(!Character.isDigit(c[i])){ //判断
System.out.println("存在非数字字符!");
break;
}
if(c.length>13){
System.out.println("您输入长度超过13位");
break;
}
if(nteger.ValueOf(c)=0){
System.out.println("第一位不能为0");
break;
}
}
}
}
} |