Basic to bits are bugging me...
Java stores negative numbers in form of two's complement. Ok! I know what two's complement is all about, turning 0's to 1's, 1's to 0's and adding a 1 to it. So let us say to store -7 in java way, I do a two's complement of its binary equivalent
0000 0000 0000 0000 0000 0000 0000 0111
and get
1111 1111 1111 1111 1111 1111 1111 1001.
Now, how do I revert back to -7 from here? I mean how do you say that it is a negative number and that it equals to seven, ok forget about the sign part that will be known by MSB, but what about value? :roll:
[ July 04, 2005: Message edited by: Akhil Trivedi ]
[ July 04, 2005: Message edited by: Akhil Trivedi ]