> ## 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 NOT Operator
- URL: https://www.javahandbook.com/bitmask/introduction-to-not-operator/
- Published: 2024-06-16T07:32:03.000Z
- Updated: 2025-08-07T03:19:29.000Z
- Author: Gopi Gorantala
- Tags: NOT Operator, #bitmask, #docs

The Bitwise NOT operator evaluates the binary representation of the value of a single input. If the bit contains 1, the output will be 0 for that bit location. If the bit contains 0, the output will be 1.

### Introduction

This lesson introduces the tilde '\~' character. This is applied to a single operand and inverts each input operand's bit.

### Sketch

This is the same as the NOT gate we studied in the digital electronics chapter shown below:

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

Logic NOT gate

## What is the Bitwise NOT operator?

The Bitwise NOT operator is denoted by `~`.

The Bitwise operator evaluates the binary representation of the value of a single input. The Bitwise complement of the binary representation is determined for each bit in the binary representation. If the bit contains 1, the output will be 0 for that bit location. If the bit contains 0, the output will be 1.

### Syntax

```java
~a
```

- 1 => yields 0
- 0 => yields 1

### Bitwise \~ Table

| a | \~a |
| - | --- |
| 1 | 0   |
| 0 | 1   |

### Truth table

| a     | \~a   |
| ----- | ----- |
| True  | False |
| False | True  |

Let’s see some of the Bitwise `NOT` operator examples in the next lesson.