在Java中,当使用左移位运算符执行某些操作时,变量的值将变为负值

在Java中,当使用左移位运算符执行某些操作时,变量的值将变为负值,java,Java,请解释为什么它的显示方式不同。感谢您的时间和宝贵的评论。1二进制为00000001。所以1你确实明白,1请具体点,我不明白你在这里的意思,看我是否直接写一行代码来执行1我已经非常具体了。我问过你是否了解两个具体事实。显然你没有。@MohithP Quote格式用于引号。你重新格式化的文本是计算机输出的,应该不要处理。谢谢EJP,我很晚才收到你的意思…我明白了 public class Sample { public static void main(String[] args) {

请解释为什么它的显示方式不同。感谢您的时间和宝贵的评论。

1二进制为00000001。所以1你确实明白,
1请具体点,我不明白你在这里的意思,看我是否直接写一行代码来执行1我已经非常具体了。我问过你是否了解两个具体事实。显然你没有。@MohithP Quote格式用于引号。你重新格式化的文本是计算机输出的,应该不要处理。谢谢EJP,我很晚才收到你的意思…我明白了
public class Sample {
    public static void main(String[] args) {
        byte[] _temp1 = new byte[4];
        byte[] _temp2 = new byte[4];
        for(int i=0;i<_temp1.length; i++){
            _temp1[i/8] |= (1<<(7-(i%8)));
            System.out.println("Binary representation of _temp1["+(i/8)+"] is "+ Integer.toBinaryString(_temp1[i/8])+"decimal representation of temp1 is "+_temp1[i/8]);
            _temp2[i/8] |=(1<<(i%8));
            System.out.println("Binary representation of _temp2["+(i/8)+"] is "+ Integer.toBinaryString(_temp2[i/8])+"decimal representation of temp2 is "+_temp2[i/8]);

        }
    }   
}
Binary representation of _temp1[0] is 11111111111111111111111110000000decimal representation of temp1 is -128
Binary representation of _temp2[0] is 1decimal representation of temp2 is 1
Binary representation of _temp1[0] is 11111111111111111111111111000000decimal representation of temp1 is -64
Binary representation of _temp2[0] is 11decimal representation of temp2 is 3
Binary representation of _temp1[0] is 11111111111111111111111111100000decimal representation of temp1 is -32
Binary representation of _temp2[0] is 111decimal representation of temp2 is 7
Binary representation of _temp1[0] is 11111111111111111111111111110000decimal representation of temp1 is -16
Binary representation of _temp2[0] is 1111decimal representation of temp2 is 15