public class Test {
public static void main(String[] args) {
int y = 37;
int you = Integer.parseInt("133", y);
System.out.println(you);
}
}
Exception in thread "main" java.lang.NumberFormatException: radix 37 greater than Character.MAX_RADIX
at java.lang.Integer.parseInt(Integer.java:426)
at com.inspur.Test.main(Test.java:11)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
public class Test {
public static void main(String[] args) {
int y = 36;
int you = Integer.parseInt("133", y);
System.out.println(you);
}
}
1407
Character.MIN_RADIX=2
Character.MAX_RADIX=36
parseInt(String s, int radix)參數中
radix的範圍是在2~36之間,
超出範圍會拋異常。
其中s的長度也不能超出7,否則也會拋異常