/** * Java 高位低位 */public class App { public static void main( String[] args ) { int i = 0xFFC0; int low = i & 0xFF; int high = i >>> 8; System.out.println("---------------------------------"); System.out.println("i:" + i); System.out.println("i:" + Integer.toBinaryString(i)); System.out.println("---------------------------------"); System.out.println("低位 low:" + low); System.out.println("低位 low:" + Integer.toBinaryString(low)); System.out.println("---------------------------------"); System.out.println("低位 high:" + high); System.out.println("低位 high:" + Integer.toBinaryString(high)); System.out.println("---------------------------------"); } }
输出:
---------------------------------
i:65472
i:1111111111000000
---------------------------------
低位 low:192
低位 low:11000000
---------------------------------
低位 high:255
低位 high:11111111
---------------------------------
时间: 2024-11-22 16:30:14