& : 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:


CMP homejump to top You can get the freshest copy of this page from: or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror)
http://mindprod.com/jgloss/andoperator.html J:\mindprod\jgloss\andoperator.html
logofeedback Please email your feedback for publication, letters to the editor, errors, omissions, typos, formatting errors, ambiguities, unclear wording, broken/redirected link reports, suggestions to improve this page or comments to Roedy Green : feedback email If you want your message kept confidential, not considered for posting, please explicitly specify that.
mindprod.com IP:[65.110.21.43]
view BlogYour face IP:[38.107.179.210]
You are visitor number 11.