打印整数的补码

mac2022-06-30  21

public class IntegerExchange { public static void main(String[] args) { int a = -6; for (int i=0; i<32; i++) { int t = (a & 0x80000000>>>i)>>>(31-i); System.out.print(t); } System.out.println(); System.out.println(Integer.toBinaryString(a)); } }

 

转载于:https://www.cnblogs.com/R4mble/p/7991617.html

相关资源:JAVA上百实例源码以及开源项目
最新回复(0)