public static void main(String[] args) {
System.out.println(Integer.toBinaryString(-16));
System.out.println(Integer.toBinaryString(-16>>2));
System.out.println(Integer.toBinaryString(16));
System.out.println(Integer.toBinaryString(16>>2));
System.out.println(Integer.toBinaryString(-16));
System.out.println(Integer.toBinaryString(-16>>>2));
System.out.println(Integer.toBinaryString(16));
System.out.println(Integer.toBinaryString(16>>>2));
System.out.println(16 >>> 2);
System.out.println(16 >> 2);
System.out.println(-16 >>> 2);
System.out.println(-16 >> 2);
/*
结论:
>> :
负数右移用1补位
正数右移用0补位
>>>:
无论正负,都用0补位
*/
}
原文:https://www.cnblogs.com/snail-gao/p/13593812.html