public static int ntz3(long x) {
    // another implementation taken from Hackers Delight, extended to 64 bits
    // and converted to Java.
    // Many 32 bit ntz algorithms are at http://www.hackersdelight.org/HDcode/ntz.cc
    int n = 1;

    // do the first step as a long, all others as ints.
    int y = (int) x;
    if (y == 0) {
      n += 32;
      y = (int) (x >>> 32);
    }
    if ((y & 0x0000FFFF) == 0) {
      n += 16;
      y >>>= 16;
    }
    if ((y & 0x000000FF) == 0) {
      n += 8;
      y >>>= 8;
    }
    if ((y & 0x0000000F) == 0) {
      n += 4;
      y >>>= 4;
    }
    if ((y & 0x00000003) == 0) {
      n += 2;
      y >>>= 2;
    }
    return n - (y & 1);
  }
returns 0 based index of first set bit
<br/> This is an alternate implementation of ntz()
ambry-utils/src/main/java/com/github/ambry/utils/BitUtil.java