Home> Java> javaTutorial> body text

Os operadores bitwise AND, OR, XOR e NOT

PHPz
Release: 2024-08-17 18:32:41
Original
281 people have browsed it

Os operadores bitwise AND, OR, XOR e NOT

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 by a value.
  • Important in systems programming for manipulating device status bits.

2. Bitwise Operator Table

  • &: AND bitwise
  • |: OR bitwise
  • ^: bitwise XOR (exclusive OR)
  • >>: Shift right
  • >>>: Right shift without signal
  • <<: Shift left
  • ~: One's complement (unary NOT)

3. AND, OR, XOR and NOT operators

  • Operate bit by bit, unlike Boolean logical operators.

4. Example of AND Bitwise

  • Can be used to disable bits.

Bitwise AND Example
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!

source:dev.to
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!