public static int getNumBitsPerValue(int maxValue) {
    // Use at least one bit even there is only one possible value
    if (maxValue <= 1) {
      return 1;
    }
    int numBitsPerValue = Byte.SIZE;
    while (maxValue > 0xFF) {
      maxValue >>>= Byte.SIZE;
      numBitsPerValue += Byte.SIZE;
    }
    return numBitsPerValue - FIRST_BIT_SET[maxValue];
  }
@Test
  public void testGetNumBitsPerValue() {
    // Should return 1 for max value 0
    assertEquals(PinotDataBitSet.getNumBitsPerValue(0), 1);

    for (int i = 0; i < NUM_ITERATIONS; i++) {
      int maxValue = RANDOM.nextInt(Integer.MAX_VALUE) + 1;
      int actual = PinotDataBitSet.getNumBitsPerValue(maxValue);
      int expected = 0;
      while (maxValue > 0) {
        maxValue >>>= 1;
        expected++;
      }
      assertEquals(actual, expected);
    }
  }