> ## Content Index
> Fetch the complete content index at: https://www.javahandbook.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Introduction to Bitwise AND operator
- URL: https://www.javahandbook.com/bitmask/introduction-to-bitwise-and-operator/
- Published: 2024-06-16T06:19:03.000Z
- Updated: 2025-08-07T02:48:30.000Z
- Author: Gopi Gorantala
- Tags: #docs, #bitmask, AND Operator

### Introduction

Bitwise AND is the most commonly used logical Bitwise operator. It is represented by a sign (&).

AND operator is the same as the AND gate we studied in the chapter on digital electronics, as shown below:

### Sketch

![Logic AND gate](https://storage.ghost.io/c/00/01/0001b1c8-8c52-4cdb-b3c7-c0746bea790e/content/images/2025/08/AND-gate.svg)

Logic AND gate

### What is the Bitwise AND operator?

The Bitwise AND operator is denoted by `&`. When an AND gate is given with two inputs, the corresponding output will be:

- If two input bits are 1, the output is 1.
- In all other cases, it's 0\. For example
- 1 & 0 => yields to 0.
- 0 & 1 => yields to 0.
- 0 & 0 => yields to 0.

### Syntax

```java
a & b
```

AND compares each bit of the **first operand** to the **second operand**’s corresponding bit. If both bits are 1, the corresponding result bit is set to 1\. Otherwise, the corresponding result bit is set to 0.

### Truth table

![](https://www.ggorantala.dev/content/images/2022/12/Screenshot-2022-12-24-at-12.20.59.png)

##