public class Test {
public static void main(String[] args) {
int s = 10;
s >>= 10;
System.out.println(s);
}
}s >>= 10; >>=是什么意思,只见过>>,感谢。
public static void main(String[] args) {
int s = 10;
s >>= 10;
System.out.println(s);
}
}s >>= 10; >>=是什么意思,只见过>>,感谢。
相当于
s =s>> 10;
其实就是向右位移10个比特位如果
10的二进数是1010
一个整型数在JAVA中是占32个比特,所以1010前面有28个0
只要右移大于或等于4位(除了周期数,如32)就会为0