class Bitwise {
    public static void main(String args[]) {
        byte a = 3;  // 2進数の 00000011
        byte b = 5;  // 2進数の 00000101
        byte c;
        
        c = (byte) ( a & b );  // 論理積
        System.out.println( "a = "+a+", b = "+b+", AND = "+c);
        
        c = (byte) ( a | b );  // 論理和
        System.out.println( "a = "+a+", b = "+b+", OR  = "+c);
        
        c = (byte) ( a ^ b );  // 排他的論値和
        System.out.println( "a = "+a+", b = "+b+", XOR = "+c);
        
        c = (byte) ~a;  // ビットの反転
        System.out.println( "a = "+a+", Reverse = "+c);
     }
}        