This happens when "the string cannot be parsed as an integer." Among other reasons, this will occur if the value exceeds Integer.MAX_VALUE or Integer.MIN_VALUE.
The largest numerical parsing as int is 2147483647 (231-1), and the longest is 9223372036854775807 (263-1), only about two times. To parse arbitrarily long numbers, use BigInteger:
import java.math.BigInteger; BigInteger number = new BigInteger(hexValue);
source share