復(fù)合常量的問題
可以使用一個(gè)變量或字段記錄幾個(gè)復(fù)合狀態(tài):
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)?);
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)?);
posted on 2007-04-20 10:26 ideame 閱讀(863) 評(píng)論(0) 編輯 收藏 所屬分類: Java