1. Introduction to Bitwise Operators
- Bitwise operators operate on types such as long, int, short, char and byte.
- Cannot be used with boolean, float, double or class types.
- Used to test, set or shift individual bits in a value.
- Important in systems programming for manipulating device status bits.
2. Bitwise Operator Table
- &: AND bitwise
- |: OR bitwise
- ^: bitwise XOR (exclusive OR)
- >>: Shift to the right
- >>>: Shift to the right without signal
- <<: Shift left
- ~: One's complement (UNARY NOT)
3. AND, OR, XOR and NOT operators
- They operate bit by bit, unlike Boolean logical operators.
4. Bitwise AND Example
- Can be used to disable bits.
Example of Bitwise AND
Can be used to disable bits.
See examples in the repository
UpCase
ShowBits
LowCase
Encode
NotDemo
Repo Link: Cap5 package
https://github.com/devs-javagirl/java-para-iniciantes
The above is the detailed content of Os operadores bitwise AND, OR, XOR e NOT. For more information, please follow other related articles on the PHP Chinese website!
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn