The byte
value 11010100
represents a negative number (-44
), because the most significant bit is set. When this undergoes primitive widening conversion, it must still represent the same negative value in the two's complement representation. This done using sign extension. That means that all new bits are the same as the original sign bit.
11010100 => -44
11111111 11111111 11111111 11010100 => -44
If this did not occur, then the sign bit would no longer be a sign bit, and it would be interpreted "normally", and the value would no longer be the same.
00000000 00000000 00000000 11010100 => 212
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…