previous | start | next

Sign bit for two's complement representation

For signed integer types, e.g. short, int, long, positive values (and 0) are represented with the leftmost bit equal to 0.

For any such representation of a positive value, the two's complement, which is the corresponding negative value, will have a 1 in the leftmost bit.

So the left most bit is the "sign" bit. A sign bit of 0 means the number is 0 or positive; a sign bit of 1 means a negative number.



previous | start | next