public static short bitLengthInWord(int word) {
    if (word < 0) {
      return 32;
    }
    if (word < (1 << 16)) {
      if (word < 1 << 8) {
        return BIT_LENGTH[word];
      } else {
        return (short) (BIT_LENGTH[word >>> 8] + 8);
      }
    } else {
      if (word < (1 << 24)) {
        return (short) (BIT_LENGTH[word >>> 16] + 16);
      } else {
        return (short) (BIT_LENGTH[word >>> 24] + 24);
      }
    }
  }
Returns the minimal number of bits to represent the given integer value.

@param word
         int32 value
@return the minimal number of bits to represent the given integer value
common/src/java/org/apache/hadoop/hive/common/type/SqlMathUtil.java