The max value of Integer is 2147483647
, and obviously 111001101100111
is much bigger than Integer.MAX_VALUE
.
Integer.valueOf(comboS)
calls Integer.parseInt(str)
eventually. That's why you received a NumberFormatException
.
If your want to parse 111001101100111
in binary rather than decimalism. Integer.parseInt(comboS, 2)
will work.
Or use BigInteger
instead, which has no upper limit.