The easiest way to understand is that 2's complement is 1's complement + 1. Also the sign of the original number should be preserved. This will gives us : FFFF = 1111111111111111 1's complement of this = 0000000000000000 Plus 1 will make : 0000000000000001 The original number was negative (1 in the MSB position) So the answer is -1. Thanks, Sudd
This subject can be a little tricky if one is not sure of the rules. But the rules are pretty straightforward. I think one of the Dietel's "How to program.." book used to have an appendix on Number Systems. I found this section very useful. Or, if you have access to some Digital Electronics book, those will definitely cover the complement arithmetics. (I learnt from one of those in my college years) Sudd
SCJP 1.4, SCWCD, SCBCD 1.3
A lot of people cry when they cut onions. The trick is not to form an emotional bond. This tiny ad told me:
Free, earth friendly heat - from the CodeRanch trailboss