可以使用一個變量或字段記錄幾個復合狀態:
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)?);