private static InputStream is = System.in;
public static int nextInt() {
try {
int i;
while ((i = is.read()) < 45 || i > 57) {
}
int mark = 1, temp = 0;
if (i == 45) {
mark = -1;
i = is.read();
}
while (i > 47 && i < 58) {
temp = temp * 10 + i - 48;
i = is.read();
}
return temp * mark;
} catch (IOException e) {
e.printStackTrace();
}
return -1;
}
快速读取数字程序 Java
最新推荐文章于 2023-02-07 16:32:46 发布