Rally Krish

Greenhorn

Posts: 5

vidya sagar

Ranch Hand

Posts: 580

Rally Krish

Greenhorn

Posts: 5

posted 11 years ago

Java uses two's complement to represent integers. But to summarize the link -- to negate a number, the two's complement operation is to invert all the bits, and add one.

Henry

Originally posted by Rally Krish:

vidya sagar,

studying, i got struck here "-6 in binary is 11111010"

again i need to know how exactly the conversion is taking place

Thanks

Java uses two's complement to represent integers. But to summarize the link -- to negate a number, the two's complement operation is to invert all the bits, and add one.

Henry

It is sorta covered in the JavaRanch Style Guide. |