@Test public void testBitNum() { Assert.assertEquals(Util.bitNum(0), 0); Assert.assertEquals(Util.bitNum(1), 1); Assert.assertEquals(Util.bitNum(2), 2); Assert.assertEquals(Util.bitNum(4), 3); Assert.assertEquals(Util.bitNum(8), 4); Assert.assertEquals(Util.bitNum(16), 5); Assert.assertEquals(Util.bitNum(32), 6); Assert.assertEquals(Util.bitNum(64), 7); Assert.assertEquals(Util.bitNum(128), 8); Assert.assertEquals(Util.bitNum(256), 9); Assert.assertEquals(Util.bitNum(1024), 11); Assert.assertEquals(Util.bitNum(65536), 17); }
static int bitNum(long val) { int bit = 0; for (; val != 0L; bit++) val >>>= 1; return bit; }
Util { static int bitNum(long val) { int bit = 0; for (; val != 0L; bit++) val >>>= 1; return bit; } }
Util { static int bitNum(long val) { int bit = 0; for (; val != 0L; bit++) val >>>= 1; return bit; }  }
Util { static int bitNum(long val) { int bit = 0; for (; val != 0L; bit++) val >>>= 1; return bit; }   }
Util { static int bitNum(long val) { int bit = 0; for (; val != 0L; bit++) val >>>= 1; return bit; }    }