How do I do bitwise exclusive OR operation?

package org.kodejava.example.lang;

public class XORDemo {
    public static void main(String[] args) {
        int numberA = 16;
        int numberB = 32;

        // Operator ^ is used for doing bitwise exclusive OR operation
        int result = numberA ^ numberB;

        System.out.println(numberA + " ^ " + numberB + " = " + result);

        // Print the result in binary format
        System.out.println(Integer.toBinaryString(numberA) +
                " ^ " + Integer.toBinaryString(numberB) +
                " = " + Integer.toBinaryString(result));
    }
}

The program prints the following output:

16 ^ 32 = 48
10000 ^ 100000 = 110000

How do I do bitwise OR operation?

package org.kodejava.example.lang;

public class ORDemo {
    public static void main(String[] args) {
        int numberA = 16;
        int numberB = 4;

        // Operator "|" is used for doing bitwise OR operation
        int result = numberA | numberB;

        System.out.println(numberA + " | " + numberB + " = " + result);

        // Print the result in binary format
        System.out.println(Integer.toBinaryString(numberA) +
                " | " + Integer.toBinaryString(numberB) +
                " = " + Integer.toBinaryString(result));
    }
}

The result of the code snippet:

16 | 4 = 20
10000 | 100 = 10100

How do I do bitwise AND operation?

package org.kodejava.example.lang;

public class ANDDemo {
    public static void main(String[] args) {
        int numberA = 16;
        int numberB = 16;

        // Operator "&"  is used for doing bitwise AND operation
        int result = numberA & numberB;

        System.out.println(numberA + " & " + numberB + " = " + result);

        // Print the result in binary format
        System.out.println(Integer.toBinaryString(numberA) +
                " & " + Integer.toBinaryString(numberB) +
                " = " + Integer.toBinaryString(result));
    }
}

The result of the code snippet:

16 & 16 = 16
10000 & 10000 = 10000