欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

复合常量的问题

程序员文章站 2024-01-06 18:19:28
...



int a = 1;
System.out.println(a);
System.out.println("Integer.toBinaryString(a)=" +
Integer.toBinaryString(a));
System.out.println("Integer.toHexString(a)=" + Integer.toHexString(a));
System.out.println("Integer.toOctalString(a)=" +
Integer.toOctalString(a));
a = 2;
System.out.println(a);
System.out.println("Integer.toBinaryString(a)=" +
Integer.toBinaryString(a));
System.out.println("Integer.toHexString(a)=" + Integer.toHexString(a));
System.out.println("Integer.toOctalString(a)=" +
Integer.toOctalString(a));

a = 4;
System.out.println(a);
System.out.println("Integer.toBinaryString(a)=" +
Integer.toBinaryString(a));
System.out.println("Integer.toHexString(a)=" + Integer.toHexString(a));
System.out.println("Integer.toOctalString(a)=" +
Integer.toOctalString(a));

a = 8;
System.out.println(a);
System.out.println("Integer.toBinaryString(a)=" +
Integer.toBinaryString(a));
System.out.println("Integer.toHexString(a)=" + Integer.toHexString(a));
System.out.println("Integer.toOctalString(a)=" +
Integer.toOctalString(a));

int b = 1 | 2 | 4 | 8;
System.out.println("1 | 2 | 4 | 8 = " + b);

int b1 = 4;
System.out.println(b1 + " is In " + b + " ? " + ((b1 & b) == b1) );


复合常量的问题
            
    
    博客分类: 随笔  

jamax 2007-04-20 10:26 发表评论