& : Java Glossary


&
Performs a bit-wise logical and, usually on two ints. It can also be used on booleans in logical expressions, though normally you use &&. && is sometimes called short circuit & or McCarthy &.

0b0101_0101 & 0b0001_11000b0001_0100

& logical AND is a logical carryless bitwise multiply, used for masking (getting rid of parts of a word you don’t want), 1s where both operands have a 1 otherwise 0. Don’t confuse this with &&.

0 & 00
0 & 10
1 & 00
1 & 11

& Tips

Here is how to and together an array of booleans:


This page is posted
on the web at:

http://mindprod.com/jgloss/andoperator.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\andoperator.html
logo
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.
Blog
IP:[65.110.21.43]
Your face IP:[23.20.50.20]
You are visitor number