# Find

> Returns the index of the first occurrence in this array of "N" contiguous 0 bits.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Collections.LowLevel.Unsafe](/engine/6000.7/script-reference/unity/collections/lowlevel/unsafe.md)
* **Assembly:** UnityEngine.ManagedKernelModule

## Find(int, int)

Returns the index of the first occurrence in this array of "N" contiguous 0 bits.

```csharp
public readonly int Find(int pos, int numBits)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Index of the bit at which to start searching.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Number of contiguous 0 bits to look for.

### Returns

| Type                                                       | Description                                                                                                                                                                                      |
| ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The index of the first occurrence in this array of `numBits` contiguous 0 bits. Range is pos up to (but not including) the length of this array. Returns int.MaxValue if no occurrence is found. |

### Remarks

The search is linear.

## Find(int, int, int)

Returns the index of the first occurrence in this array of a given number of contiguous 0 bits.

```csharp
public readonly int Find(int pos, int count, int numBits)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Index of the bit at which to start searching.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Number of indexes to consider as the return value.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Number of contiguous 0 bits to look for.

### Returns

| Type                                                       | Description                                                                                                                                                                           |
| ---------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The index of the first occurrence in this array of `numBits` contiguous 0 bits. Range is pos up to (but not including) `pos + count`. Returns int.MaxValue if no occurrence is found. |

### Remarks

The search is linear.
