Bit operations in Java

Source: Internet
Author: User

Just looking at the PHP basics in Imooc to find a particularly easy-to-understand description of "about XOR or operation."

There were 4 ways to learn Java before, and it was recorded like this:

& The Bitwise AND (and) two correspond to the binary are 1 is 1, the remainder is all 0

| The bitwise OR (or) two binary number has one of 1 is 1, only two 0 is 0

~ Bitwise non (not) binary to negate

^ Bitwise XOR (XOR) two binary is the same as 0, the difference is 1 in fact, the most difficult to understand is this XOR operation.

Move directly to (the original URL point i):

We can understand the logical operation from the perspective of voting:

1, logic and: require everyone to vote for consent, will pass an agreement;

2, logic or: only ask a person to vote to agree on the line;

3. Logical XOR : only one person can vote for consent;

4, logic is not: a person to oppose, but through the logic of non-, so that its objection invalid;

Bit operations in Java

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.