> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Java Bitwise AND

The `&` operator in Java is a binary operator that functions as either a bitwise AND or a logical (non-short-circuiting) AND, depending on the data types of its operands.

## Bitwise AND (Integral Types)

When applied to integral data types (`byte`, `short`, `int`, `long`, `char`), the `&` operator performs a bit-by-bit comparison of the two's complement binary representation of the operands.

**Mechanics:**

* For each corresponding bit position, the result bit is `1` if and only if both operand bits are `1`. Otherwise, the result bit is `0`.
* Java applies binary numeric promotion before the operation. If neither operand is a `long`, both are promoted to `int`. If one is a `long`, the other is promoted to `long`.

**Syntax:**

```java theme={"dark"}
int a = 12;         // Binary: 0000 1100
int b = 25;         // Binary: 0001 1001
int result = a & b; // Binary: 0000 1000 (Decimal: 8)
```

## Logical AND (Boolean Types)

When applied to `boolean` operands, the `&` operator performs a logical AND operation.

**Mechanics:**

* The expression evaluates to `true` if and only if both the left-hand side (LHS) and right-hand side (RHS) operands evaluate to `true`.
* **Non-short-circuiting evaluation:** Unlike the conditional AND operator (`&&`), the `&` operator guarantees the evaluation of both operands. Even if the LHS evaluates to `false` (which mathematically guarantees the final result will be `false`), the RHS expression is still fully executed.

**Syntax:**

```java theme={"dark"}
boolean condition1 = false;
boolean condition2 = true;
boolean result = condition1 & condition2; // Evaluates to false
```

## Truth Table

The underlying logic for both contexts maps to the following truth table (where `1` maps to `true` and `0` maps to `false`):

| Operand 1 (LHS) | Operand 2 (RHS) | Result (`LHS & RHS`) |
| :-------------- | :-------------- | :------------------- |
| `1` / `true`    | `1` / `true`    | `1` / `true`         |
| `1` / `true`    | `0` / `false`   | `0` / `false`        |
| `0` / `false`   | `1` / `true`    | `0` / `false`        |
| `0` / `false`   | `0` / `false`   | `0` / `false`        |

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor Java Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
