code: private static BitSet byteArrayToBitSet(byte[] array) {
  
      BitSet bitSet = new BitSet();
      int index = 0;
      for (byte b : array) {
        int b1 = ((int)b) + 128;
  
        bitSet.set(index++, (b1 >> 7) % 2 == 1);
        bitSet.set(index++, (b1 >> 6) % 2 == 1);
        bitSet.set(index++, (b1 >> 5) % 2 == 1);
        bitSet.set(index++, (b1 >> 4) % 2 == 1);
        bitSet.set(index++, (b1 >> 3) % 2 == 1);
        bitSet.set(index++, (b1 >> 2) % 2 == 1);
        bitSet.set(index++, (b1 >> 1) % 2 == 1);
        bitSet.set(index++, b1 % 2 == 1);
      }
  
      return bitSet;
    }
docs: helper for gap encoding.