Language syntax
Integer bitwise operators
Performs AND, OR, exclusive OR and complement on integer bit patterns after applicable promotion. A complement flips every bit, not just displayed binary digits. Syntax shows alternative expressions.
Formal Syntax & Structure
java syntaxjava
a & b; a | b; a ^ b; ~aWorking Example
Example Snippetjava
public class Main { public static void main(String[] args) { int flags = 0b110; System.out.println(flags & 0b010); System.out.println(flags ^ 0b100); }}