### Question:
Longs { public static int bitCount(long lng) { lng = (lng & 0x5555555555555555L) + ((lng >> 1) & 0x5555555555555555L); lng = (lng & 0x3333333333333333L) + ((lng >> 2) & 0x3333333333333333L); int i = (int) ((lng >>> 32) + lng); i = (i & 0x0F0F0F0F) + ((i >> 4) & 0x0F0F0F0F); i = (i & 0x00FF00FF) + ((i >> 8) & 0x00FF00FF); i = (i & 0x0000FFFF) + ((i >> 16) & 0x0000FFFF); return i; }  static long decode(String string); static long parseLong(String string); static long parseLong(String string, int radix); static String toBinaryString(long l); static String toHexString(long l); static String toString(long l); static long highestOneBit(long lng); static long lowestOneBit(long lng); static int numberOfLeadingZeros(long lng); static int numberOfTrailingZeros(long lng); static int bitCount(long lng); static long rotateLeft(long lng, int distance); static long rotateRight(long lng, int distance); static long reverseBytes(long lng); static long reverse(long lng); static final long MAX_VALUE; static final long MIN_VALUE; }### Answer:
@Test public void test_bitCountJ() { assertEquals(0, Longs.bitCount(0x0)); assertEquals(1, Longs.bitCount(0x1)); assertEquals(1, Longs.bitCount(0x2)); assertEquals(2, Longs.bitCount(0x3)); assertEquals(1, Longs.bitCount(0x4)); assertEquals(2, Longs.bitCount(0x5)); assertEquals(2, Longs.bitCount(0x6)); assertEquals(3, Longs.bitCount(0x7)); assertEquals(1, Longs.bitCount(0x8)); assertEquals(2, Longs.bitCount(0x9)); assertEquals(2, Longs.bitCount(0xA)); assertEquals(3, Longs.bitCount(0xB)); assertEquals(2, Longs.bitCount(0xC)); assertEquals(3, Longs.bitCount(0xD)); assertEquals(3, Longs.bitCount(0xE)); assertEquals(4, Longs.bitCount(0xF)); assertEquals(8, Longs.bitCount(0xFF)); assertEquals(12, Longs.bitCount(0xFFF)); assertEquals(16, Longs.bitCount(0xFFFF)); assertEquals(20, Longs.bitCount(0xFFFFF)); assertEquals(24, Longs.bitCount(0xFFFFFF)); assertEquals(28, Longs.bitCount(0xFFFFFFF)); assertEquals(64, Longs.bitCount(0xFFFFFFFFFFFFFFFFL)); }