@Test public void shouldReturnTheNumberOfDifferentBitsWhenNumAIsLower() { int numA = 78; int numB = 99; int numberOfDifferentBits = bitsToTransform.calculate(numA, numB); assertEquals(4, numberOfDifferentBits); }
public int calculate(int numA, int numB) { int differentBits = 0; for (int XOR = numA ^ numB; XOR != 0; XOR = XOR & (XOR - 1)) { differentBits++; } return differentBits; }
BitsToTransform { public int calculate(int numA, int numB) { int differentBits = 0; for (int XOR = numA ^ numB; XOR != 0; XOR = XOR & (XOR - 1)) { differentBits++; } return differentBits; } }
BitsToTransform { public int calculate(int numA, int numB) { int differentBits = 0; for (int XOR = numA ^ numB; XOR != 0; XOR = XOR & (XOR - 1)) { differentBits++; } return differentBits; }  }
BitsToTransform { public int calculate(int numA, int numB) { int differentBits = 0; for (int XOR = numA ^ numB; XOR != 0; XOR = XOR & (XOR - 1)) { differentBits++; } return differentBits; }  int calculate(int numA, int numB); }
BitsToTransform { public int calculate(int numA, int numB) { int differentBits = 0; for (int XOR = numA ^ numB; XOR != 0; XOR = XOR & (XOR - 1)) { differentBits++; } return differentBits; }  int calculate(int numA, int numB);  }