This operator performs bit by bit operation on binary representation of integers
There are different types of bit wise operators which are:
&: This operator performs binary AND bit by bit on the operands. It checks both the conditions whether first condition is true or false
|: This operator performs binary OR bit by bit on the operands. It checks both the conditions whether first condition is true or false
^: This operator performs binary XOR bit by bit on the operands. It returns bit by bit XOR of input values, if respective bits are different, it gives 1, else it gives 0.
package com.test.basics;
public class TestBitWiseOperator {
public static void main (String[] arg)
{
int x = 5;
int y = 7;
// bitwise and
// 0101 & 0111=0101 = 5
System.out.println("a&b = " + (x & y));
// bitwise or
// 0101 | 0111=0111 = 7
System.out.println("a|b = " + (x | y));
// bitwise xor
// 0101 ^ 0111=0010 = 2
System.out.println("a^b = " + (x ^ y));
}
}

Therefore we discussed different types of bitwise operator with examples above. Happy Learning in IT Whistle.