Quite simply,
Java just chops off the unwanted bytes for the cast.... Here is the long in binary....
l = 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 1000 0010
Here is the byte in binary....
b = 1000 0010
Now, if you notice that the high bit of this byte is a one. This means that it is a negative number. To get full details on how negative numbers are represented, just google "twos complement".
And after you read how twos complement works....
b = 1000 0010
~b = 0111 1101
~b + 1 = 0111 1110 = -b = 126
b = -126
(hope I got the math right ...
)
Henry