For example : Byte primitive data type has 8 bits. It Supports -128 to +127. One bit is a sign bit, so when all bits are 1 and sign bit is 0, represent +127, and when all bits are 0 and sign bit is 1, it can show -127, how represent -128?
Asked
Active
Viewed 37 times
0
-
-127 is `1000 0001`, -128 is `1000 0000`. – rgettman Sep 28 '18 at 18:13
-
java consider the sign bit as value bit ? I can't understand. 1000 0000 after 2's complement and without considering the sign bit is -127. So how does it work? @rgettman – HFDev Sep 28 '18 at 18:36
-
The "sign bit" is really just a value of `-128` for bytes. – rgettman Sep 28 '18 at 18:39
-
So, the sign bit actually has a negative weight. correct? – HFDev Sep 28 '18 at 19:02