What Are Bitwise Operators?

Bit operations are unary and binary operations on bit patterns or binary numbers in bit design in programming.

Bit operators are used to operate on binary bits. Java provides the bit operators shown in the following table: In the bit operators, except for ~, the rest are binary operators.
Operands can only be integer and character data.
Six kinds of bit operators in C language:
& Bitwise AND
| Bitwise OR
^ Bitwise XOR
~ Negation
<< shift left
>> shift right
Notes on the use of bitwise operators: [2]
(1) Bit operation is to detect, set, or shift the actual binary bits in a byte or word. It is only applicable to character and integer variables and their variants, and not applicable to other data types.
(2) The results of relational and logical operation expressions can only be 1 or 0, and the results of bit operations can take values other than 0 or 1.
(3) Pay attention to the difference between the bit operator and the logical operator.

IN OTHER LANGUAGES

Was this article helpful? Thanks for the feedback Thanks for the feedback

How can we help? How can we help?