The answer should be -95, not 95. Here is how I think is gotten.
1) double 417.35 fist is truncated to int 417
2) 417 = 256 + 128 + 32 + 1 and have a binary representation of
0000 0001 1010 0001
3) it then get truncated again, because byte has only 8 bits, to
1010 0001
4) The sign bit (first bit) at step 3) is 1, therefore it is a negative number. To find the number I use the following relationship.
~x + 1 = -x
~x is 1's complement of the 8 bit in step 3) and it is
0101 1110
This number = 64 + 16 + 8 + 4 + 2 = 94
so x = - (~x + 1 ) = -95.
5) to double check it
C:\JavaRanch>
java TestByte
d = 417.35 b = -95