@Test public void countOf1InBinary() { assertEquals(BitUtils.countOf1InBinary(4), 1); assertEquals(BitUtils.countOf1InBinary(5), 2); assertEquals(BitUtils.countOf1InBinary(13), 3); }
static int countOf1InBinary(long n) { int count = 0; while (n > 0) { count = n % 2 > 0 ? count + 1 : count; n = n >> 1; } return count; }
BitUtils { static int countOf1InBinary(long n) { int count = 0; while (n > 0) { count = n % 2 > 0 ? count + 1 : count; n = n >> 1; } return count; } }
BitUtils { static int countOf1InBinary(long n) { int count = 0; while (n > 0) { count = n % 2 > 0 ? count + 1 : count; n = n >> 1; } return count; }  }
BitUtils { static int countOf1InBinary(long n) { int count = 0; while (n > 0) { count = n % 2 > 0 ? count + 1 : count; n = n >> 1; } return count; }  static boolean isPowerOf2(int n); static int binLength(int n); }
BitUtils { static int countOf1InBinary(long n) { int count = 0; while (n > 0) { count = n % 2 > 0 ? count + 1 : count; n = n >> 1; } return count; }  static boolean isPowerOf2(int n); static int binLength(int n);  }