Tag: IMA indicates a negative number for the specified COM img computer image java
Use the highest bit in the two number to indicate positive or negative.
First you have to know which one is the highest? The 1-byte type, such as the character type, the highest bit is the 7th bit, the number of 2 bytes, the highest bit is the 15th bit, the number of 4 bytes, the highest bit is the 31st bit.
numeric types of different lengths, the highest bits are different, but always the leftmost bit (see below).
The character type is fixed at 1 bytes, so the highest bit is always the 7th bit. (highest bit in red) single-byte number: 1111 1111 double-byte: 1111 1111 1111 11,114 bytes: 1111 1111 1111 1111 1111 1111 1111 1111 When we specify that a quantity is an unsigned type, its highest Bits of 1 or 0, as with other bits, are used to indicate the size of the number. When we specify that a quantity is a signed type, the highest number is called the sign bit. is 1 o'clock, indicating that the number is a negative value, which is a positive value of 0
In the computer,
Negative
Except for the highest bit
1
, they are also expressed in complementary form.
Problems with binary in Java