@Test public void numberOfBitsInTwoIsOneBasedOnBinaryOperator() { assertEquals(1, bitsCounter.countBitsToOneBasedOnBinaryOperators(2)); }
public int countBitsToOneBasedOnBinaryOperators(int n) { int result = 0; while (n > 0) { result += (n & 1) == 1 ? 1 : 0; n = n >> 1; } return result; }
BitsCounter { public int countBitsToOneBasedOnBinaryOperators(int n) { int result = 0; while (n > 0) { result += (n & 1) == 1 ? 1 : 0; n = n >> 1; } return result; } }
BitsCounter { public int countBitsToOneBasedOnBinaryOperators(int n) { int result = 0; while (n > 0) { result += (n & 1) == 1 ? 1 : 0; n = n >> 1; } return result; }  }
BitsCounter { public int countBitsToOneBasedOnBinaryOperators(int n) { int result = 0; while (n > 0) { result += (n & 1) == 1 ? 1 : 0; n = n >> 1; } return result; }  int countBitsToOneBasedOnString(int n); int countBitsToOneBasedOnBinaryOperators(int n); }
BitsCounter { public int countBitsToOneBasedOnBinaryOperators(int n) { int result = 0; while (n > 0) { result += (n & 1) == 1 ? 1 : 0; n = n >> 1; } return result; }  int countBitsToOneBasedOnString(int n); int countBitsToOneBasedOnBinaryOperators(int n);  }