public static int ntz(int val) {
    // This implementation does a single binary search at the top level only.
    // In addition, the case of a non-zero first byte is checked for first
    // because it is the most common in dense bit arrays.

    int lowByte = val & 0xff;
    if (lowByte != 0) {
      return ntzTable[lowByte];
    }
    lowByte = (val >>> 8) & 0xff;
    if (lowByte != 0) {
      return ntzTable[lowByte] + 8;
    }
    lowByte = (val >>> 16) & 0xff;
    if (lowByte != 0) {
      return ntzTable[lowByte] + 16;
    }
    // no need to mask off low byte for the last byte.
    // no need to check for zero on the last byte either.
    return ntzTable[val >>> 24] + 24;
  }
Returns number of trailing zeros in a 32 bit int value.
ambry-utils/src/main/java/com/github/ambry/utils/BitUtil.java