File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Two's complement significance Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Two Watch "Two New topic
Author

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
Ranch Hand

Joined: Sep 18, 2000
Posts: 491
    
    2

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
discussion
and also a discussion on Signed and Unsigned numbers - which elaborates the discussion.
regds.
- satya

Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Two's complement significance
 
Similar Threads
one question
Reg. Bitwise NOT
Right shift using array
Using ~ (Unary bitwise complement) for Zero
Casting from long to byte