在下面的代码中,我在输入 ~1000000000 的大数字时收到 java.lang.NumberFormatException。错误发生在倒数第二行 -\
int integer = Integer.parseInt(split[0]);
它应该在理论上工作,因为整数类型支持直到 2^32-1 但它不
Scanner user_input = new Scanner(System.in);
//accept user input and convert into double
String s = user_input.next();
double number = Double.parseDouble(s);
System.out.println(number);
String answer = "";
//Split the entered number into Integer and Decimal parts
String split[] = Double.toString(number).split("\\.");
int integer = Integer.parseInt(split[0]);
int decimal = Integer.parseInt(split[1]);