In Basic `NOT`

, `AND`

, `OR`

, `XOR`

**are** operators named with respect to their meaning if used with Boolean operands. They can also be used (for masking purposes e.g.) with integer (Long) operands. They are applied bit-by-bit in this case. Thus you get `5 OR -7 = -3`

e.g.

As known from ordinary algbra the operators are “prioritized” in a specific way. In case of the logical operators the `NOT`

binds closest to the single operand at its right side. `AND`

has highest príority among the two-sided operands like the `*`

in arithmetic. `OR`

has less binding force like the `+`

, and concerning the `XOR`

, I’m not sure.

You see, I have to admit that doubt may occur, this the more if integer expressions come into account. Therefore my advice: If you not are completely sure about the way priorities rule your expressions, disambiguate everything with the help of parentheses.