org.h2.util

## Class BitField

- java.lang.Object
- - org.h2.util.BitField

    public final class BitField
    extends java.lang.Object

A list of bits.

### Constructor Summary

Constructors
Constructor and Description
`BitField()`
`BitField(int capacity)`

### Method Summary

Methods
`void` `clear(int i)` Set bit at the given index to 'false'.
`boolean` `get(int i)` Get the bit at the given index.
`int` `getByte(int i)` Get the next 8 bits at the given index.
`int` `length()` Get the index of the highest set bit plus one, or 0 if no bits are set.
`int` `nextClearBit(int fromIndex)` Get the index of the next bit that is not set.
`void` `set(int i)` Set bit at the given index to 'true'.
`void` `set(int fromIndex, int toIndex, boolean value)` Enable or disable a number of bits.
`void` `setByte(int i, int x)` Combine the next 8 bits at the given index with OR.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### BitField

    public BitField()

#### BitField

    public BitField(int capacity)

### Method Detail

#### nextClearBit

    public int nextClearBit(int fromIndex)

Get the index of the next bit that is not set.

Parameters:
  `fromIndex` - where to start searching
Returns:
  the index of the next disabled bit

#### get

    public boolean get(int i)

Get the bit at the given index.

Parameters:
  `i` - the index
Returns:
  true if the bit is enabled

#### getByte

    public int getByte(int i)

Get the next 8 bits at the given index. The index must be a multiple of 8.

Parameters:
  `i` - the index
Returns:
  the next 8 bits

#### setByte

    public void setByte(int i,
               int x)

Combine the next 8 bits at the given index with OR. The index must be a multiple of 8.

Parameters:
  `i` - the index
  `x` - the next 8 bits (0 - 255)

#### set

    public void set(int i)

Set bit at the given index to 'true'.

Parameters:
  `i` - the index

#### clear

    public void clear(int i)

Set bit at the given index to 'false'.

Parameters:
  `i` - the index

#### set

    public void set(int fromIndex,
           int toIndex,
           boolean value)

Enable or disable a number of bits.

Parameters:
  `fromIndex` - the index of the first bit to enable or disable
  `toIndex` - one plus the index of the last bit to enable or disable
  `value` - the new value

#### length

    public int length()

Get the index of the highest set bit plus one, or 0 if no bits are set.

Returns:
  the length of the bit field