File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Two's complement significance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Two Watch "Two New topic

Two's complement significance

Sridevi Shrikanth
Ranch Hand

Joined: Jan 11, 2001
Posts: 31
What is the significance of representing number in two's complement?
Steve Fahlbusch

Joined: Sep 18, 2000
Posts: 602

It allows for all bits to be represented while eliminating the embarrassing problem of having a positive and negative zero.
for example: an 8 bit number allows values of -128 to 127.

[This message has been edited by Steve Fahlbusch (edited January 23, 2001).]
Madhav Lakkapragada
Ranch Hand

Joined: Jun 03, 2000
Posts: 5040

Steve is correct.
For more discussion on this please refer to a past
and also a discussion on Signed and Unsigned numbers - which elaborates the discussion.
- satya

Take a Minute, Donate an Hour, Change a Life
I agree. Here's the link:
subject: Two's complement significance
jQuery in Action, 3rd edition