@Test public void testGetMaxBitIndex() { assertEquals(1,BitUtils.getMaxBitIndex(1)); assertEquals(8,BitUtils.getMaxBitIndex(255)); org.junit.Assert.assertNotSame(8, BitUtils.getMaxBitIndex(256)); }
public static int getMaxBitIndex(int number) { if (number < 0) { throw new RuntimeException("negative numbers unsupported"); } int maxBit = 0; while((number = number >>> 1) >=0) { maxBit++; if (number == 0) { break; } } return maxBit; }
BitUtils { public static int getMaxBitIndex(int number) { if (number < 0) { throw new RuntimeException("negative numbers unsupported"); } int maxBit = 0; while((number = number >>> 1) >=0) { maxBit++; if (number == 0) { break; } } return maxBit; } }
BitUtils { public static int getMaxBitIndex(int number) { if (number < 0) { throw new RuntimeException("negative numbers unsupported"); } int maxBit = 0; while((number = number >>> 1) >=0) { maxBit++; if (number == 0) { break; } } return maxBit; } private  BitUtils(); }
BitUtils { public static int getMaxBitIndex(int number) { if (number < 0) { throw new RuntimeException("negative numbers unsupported"); } int maxBit = 0; while((number = number >>> 1) >=0) { maxBit++; if (number == 0) { break; } } return maxBit; } private  BitUtils(); static int getMaxBitIndex(int number); static int getMaxZeroBitIndex(int number); }
BitUtils { public static int getMaxBitIndex(int number) { if (number < 0) { throw new RuntimeException("negative numbers unsupported"); } int maxBit = 0; while((number = number >>> 1) >=0) { maxBit++; if (number == 0) { break; } } return maxBit; } private  BitUtils(); static int getMaxBitIndex(int number); static int getMaxZeroBitIndex(int number);  }