If you convert that result to hexadecimal as a 'long' you get
-2147483648 - 2147483647 = -4294967295
But Java uses 'int' by default and an 'int' is 32 bits (4 bytes). The low-order 4 bytes of that result are '00000001x' which is '1'.
-4294967295 = FFFFFFFF00000001x
Just subtract the numbers like you normally would starting at the right.
int a = -2147483648 = 80000000x int b = 2147483647 = 7FFFFFFFx
a = 5000 b = 4999 (in decimal '9' is the largest 'digit', in hexadecimal 'F' is the largest digit) What do you get if you subtract those two numbers? You get '1' because when you try to subtract the rightmost '9' from the '0' you have to borrows one from the digit to the left which means borrowing one from the '5' essentially giving the top number as '499' + '10'. Subtract 9 from the 10 giving 1. Then the top has '499' remaining and so does the bottom so the rest are zeroes: 0001.