Thanks a lot, Valentine, for the great explaination.
I found that Byte, Short, Integer and Long all have parseXXX(String s, int radix) method. I tested with a String and found that they return the same output.
I try different values of the String and these are what I think happen:
1. parseXXX() method checks for the range of the String at runtime. If the string contains integer value greater than XXX.MAX_VALUE or less than XXX.MIN_VALUE, NumberFormatException is thrown.
2. String s must contains only digits 0-9. And if the digit is not in an acceptable range of the radix, NumberFormatException is thrown at runtime. i.e. with the above example, the exception is thrown if the radix is 2 instead of 8 because base 2 contains digits 0 and 1 only.
Am I right?