I feel like I must be missing something simple, but I am getting a NumberFormatException
on the following code:
System.out.println(Integer.parseInt("howareyou",35))
It can convert the String yellow
from base 35, I don't understand why I would get a NumberFormatException
on this String.
Because the result will get greater than Integer.MAX_VALUE
Try this
System.out.println(Integer.parseInt("yellow", 35));
System.out.println(Long.parseLong("howareyou", 35));
and for
Long.parseLong("abcdefghijklmno",25)
you need BigInteger
Try this and you will see why
System.out.println(Long.MAX_VALUE);
System.out.println(new BigInteger("abcdefghijklmno",25));