> For the complete documentation index, see [llms.txt](https://boxlang.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/binary/bitmaskread.md).

# BitMaskRead

Performs a bitwise mask read operation.

## Method Signature

```
BitMaskRead(number=[long], start=[integer], length=[integer])
```

### Arguments

| Argument | Type      | Required | Description                                                             | Default |
| -------- | --------- | -------- | ----------------------------------------------------------------------- | ------- |
| `number` | `long`    | `true`   | 64-bit signed integer from which to read the mask.                      |         |
| `start`  | `integer` | `true`   | Start bit for the read mask (Integer in the range 0-31, inclusive).     |         |
| `length` | `integer` | `true`   | Length of bits in the read mask (Integer in the range 0-31, inclusive). |         |

## Examples

### Bitwise Mask Read

Uses the bitMaskRead function to read each of the corresponding bits specified in the mask

[Run Example](https://try.boxlang.io/?code=eJxLyizxTSzODkpNTNFQMNZRMNBRMFTQtOYCAGABBko%3D)

```java
bitMaskRead( 3, 0, 1 );

```

Result: 1

### Using non zero start parameter

Bit shift the mask 2 places

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

```java
bitMaskRead( 10, 2, 1 );

```

Result: 0

### Using non zero read mask start and length parameters

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

```java
bitMaskRead( 10, 1, 3 );

```

Result: 5

### Additional Examples

[Run Example](https://try.boxlang.io/?code=eJwrL8osSfUvLSkoLdFQSMos8U0szg5KTUzRUDAyNdVRACEFTQVNa65yZIVKNklFdkoYwpj6DXQUTCD6AeqjHy8%3D)

```java
writeOutput( bitMaskRead( 255, 5, 5 ) );
writeOutput( "<br>" );
writeOutput( bitMaskRead( 255, 0, 4 ) );

```

## Related

* [BinaryDecode](/boxlang-language/reference/built-in-functions/binary/binarydecode.md)
* [BinaryEncode](/boxlang-language/reference/built-in-functions/binary/binaryencode.md)
* [BitAnd](/boxlang-language/reference/built-in-functions/binary/bitand.md)
* [BitMaskClear](/boxlang-language/reference/built-in-functions/binary/bitmaskclear.md)
* [BitMaskSet](/boxlang-language/reference/built-in-functions/binary/bitmaskset.md)
* [BitNot](/boxlang-language/reference/built-in-functions/binary/bitnot.md)
* [BitOr](/boxlang-language/reference/built-in-functions/binary/bitor.md)
* [BitSh](/boxlang-language/reference/built-in-functions/binary/bitsh.md)
* [bitShln](/boxlang-language/reference/built-in-functions/binary/bitshln.md)
* [bitShrn](/boxlang-language/reference/built-in-functions/binary/bitshrn.md)
* [BitXor](/boxlang-language/reference/built-in-functions/binary/bitxor.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://boxlang.ortusbooks.com/boxlang-language/reference/built-in-functions/binary/bitmaskread.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
