# BitAnd

Performs a bitwise logical AND operation.

## Method Signature

```
BitAnd(number1=[integer], number2=[integer])
```

### Arguments

| Argument  | Type      | Required | Description                    | Default |
| --------- | --------- | -------- | ------------------------------ | ------- |
| `number1` | `integer` | `true`   | Numeric value for bitwise AND. |         |
| `number2` | `integer` | `true`   | Numeric value for bitwise AND. |         |

## Examples

### Calculate bitwise logical AND

Uses the bitAnd function to perform the logical AND operation on each pair of the corresponding bits, by multiplying them

[Run Example](https://try.boxlang.io/?code=eJxLyixxzEvRUDDVUTBW0LTmAgAoNgPd)

```java
bitAnd( 5, 3 );

```

Result: 1

### Additional Examples

[Run Example](https://try.boxlang.io/?code=eJzLzCsoLQlLzClNNVSwVTC15sqECxgBBYxMgULlRZklqf6lJUAJDYWkzBLHvBQNBYQ6Qx0FZE2aCppoWpRskorslEDCmfhtMyDLLgCxcz%2FZ)

```java
inputValue1 = 5;
inputValue2 = 255;
writeOutput( bitAnd( inputValue1, inputValue2 ) );
writeOutput( "<br>" );
inputValue1 = 5;
inputValue2 = 0;
writeOutput( bitAnd( inputValue1, inputValue2 ) );

```

## Related

* [BinaryDecode](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/binary/binarydecode)
* [BinaryEncode](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/binary/binaryencode)
* [BitMaskClear](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/binary/bitmaskclear)
* [BitMaskRead](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/binary/bitmaskread)
* [BitMaskSet](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/binary/bitmaskset)
* [BitNot](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/binary/bitnot)
* [BitOr](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/binary/bitor)
* [BitSh](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/binary/bitsh)
* [bitShln](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/binary/bitshln)
* [bitShrn](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/binary/bitshrn)
* [BitXor](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/binary/bitxor)
