I have the following code...
int Val=-32768; String Hex=Integer.toHexString(Val);
This equates to ffff8000
ffff8000
int
It overflows, because the number is negative.
Try this and it will work:
int n = (int) Long.parseLong("ffff8000", 16);