Class IntPerfectHash.BitArray

  • Enclosing class:
    IntPerfectHash

    public static class IntPerfectHash.BitArray
    extends java.lang.Object
    A helper class for bit arrays.
    • Constructor Summary

      Constructors 
      Constructor Description
      BitArray()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int countBits​(byte[] data)
      Count the number of set bits.
      static boolean getBit​(byte[] data, int x)
      Get a bit in a bit array.
      static byte[] setBit​(byte[] data, int x, boolean value)
      Set a bit in the array.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • BitArray

        public BitArray()
    • Method Detail

      • setBit

        public static byte[] setBit​(byte[] data,
                                    int x,
                                    boolean value)
        Set a bit in the array.
        Parameters:
        data - the array
        x - the bit index
        value - 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 array
        x - 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