This content has been marked as final. Show 3 replies
Integer valueOf(String s, int radix)
Returns an Integer object holding the value extracted from the specified String when parsed with the radix given by the second argument.
it throws NumberFormatException - if the String does not contain a parsable int.
Nevermind the original post. (Brainlock)
Because in Radix 2 only 1s and 0s are acceptable.
prady_jo wrote:As already mentioned, in binary notation, only 1's and 0's are permitted. Besides that, I see you also have some white spaces in your string: this will throw an exception as well.
Can any one explains why this method throws exception
Integer a = Integer. valueOf(" 123 ", 2);