Package org.h2.dev.hash
Class IntPerfectHash.BitArray
java.lang.Object
org.h2.dev.hash.IntPerfectHash.BitArray
- Enclosing class:
- IntPerfectHash
A helper class for bit arrays.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
BitArray
public BitArray()
-
-
Method Details
-
setBit
public static byte[] setBit(byte[] data, int x, boolean value) Set a bit in the array.- Parameters:
data- the arrayx- the bit indexvalue- the new value- Returns:
- the bit array (if the passed one was too small)
-
getBit
public static boolean getBit(byte[] data, int x) Get a bit in a bit array.- Parameters:
data- the arrayx- the bit index- Returns:
- the value
-
countBits
public static int countBits(byte[] data) Count the number of set bits.- Parameters:
data- the array- Returns:
- the number of set bits
-