I am getting an error because of the following line of code:
int x = color(Integer.parseInt("ffffffde",16));
The value "ffffffde" is being created by the following code:
Integer.toHexString(int_val);
Error:
Exception in thread "Animation Thread" java.lang.NumberFormatException: For input string: "ffffffde"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
I think it might be because it is a negative value.
Any ideas why or how or how to fix it?
Edit:
Turns out it is a known bug JDK-4215269 in versions of Java prior to 8.
Although you can convert integers to hex strings, you cannot convert them back if they are negative numbers!