Computers maintain data in two's complement format.
The complement of a positive number is itself. The complement of a negative number is excluding the sign bit, negating it, and adding 1.
1 byte, the value range is -128~127.
So, why is it -128~127?
Because of the computer's complement mechanism, the values in the computer are stored according to the complement code. The complement of a positive number is itself, and the complement of a negative number is the inversion of the sign bit plus 1.
Therefore, the maximum complement of a positive number is: 01111111, which is 127. The maximum complement of a negative number is 10000000. The original code is 100000000, which means it becomes -128 after adding one digit.