@Test public void shouldReturnZeroIfInputIsFullOfOnes() { int input = 63; int result = reverseBinaryNumber.reverse(input); assertEquals(0, result); }
public int reverse(int input) { int result = 1; do { result <<= 1; result |= (input & 1) == 1 ? 0 : 1; input >>= 1; } while (input != 0); result = reverseBitsOrder(result); result = removeFirstOne(result); return result; }
ReverseBinaryNumber { public int reverse(int input) { int result = 1; do { result <<= 1; result |= (input & 1) == 1 ? 0 : 1; input >>= 1; } while (input != 0); result = reverseBitsOrder(result); result = removeFirstOne(result); return result; } }
ReverseBinaryNumber { public int reverse(int input) { int result = 1; do { result <<= 1; result |= (input & 1) == 1 ? 0 : 1; input >>= 1; } while (input != 0); result = reverseBitsOrder(result); result = removeFirstOne(result); return result; } ReverseBinaryNumber(); }
ReverseBinaryNumber { public int reverse(int input) { int result = 1; do { result <<= 1; result |= (input & 1) == 1 ? 0 : 1; input >>= 1; } while (input != 0); result = reverseBitsOrder(result); result = removeFirstOne(result); return result; } ReverseBinaryNumber(); int reverse(int input); }
ReverseBinaryNumber { public int reverse(int input) { int result = 1; do { result <<= 1; result |= (input & 1) == 1 ? 0 : 1; input >>= 1; } while (input != 0); result = reverseBitsOrder(result); result = removeFirstOne(result); return result; } ReverseBinaryNumber(); int reverse(int input);  }