@Test public void sum() { assertEquals(0, SumTwoIntegerSolution.sum(0, 0)); assertEquals(1, SumTwoIntegerSolution.sum(1, 0)); assertEquals(2, SumTwoIntegerSolution.sum(0, 2)); assertEquals(6, SumTwoIntegerSolution.sum(3, 3)); assertEquals(Integer.MAX_VALUE, SumTwoIntegerSolution.sum(Integer.MAX_VALUE - 10, 10)); }
static int sum(int a, int b) { if (a == 0) return b; if (b == 0) return a; int temp; while (b != 0) { temp = a & b; a = a ^ b; b = temp << 1; } return a; }
SumTwoIntegerSolution { static int sum(int a, int b) { if (a == 0) return b; if (b == 0) return a; int temp; while (b != 0) { temp = a & b; a = a ^ b; b = temp << 1; } return a; } }
SumTwoIntegerSolution { static int sum(int a, int b) { if (a == 0) return b; if (b == 0) return a; int temp; while (b != 0) { temp = a & b; a = a ^ b; b = temp << 1; } return a; }  }
SumTwoIntegerSolution { static int sum(int a, int b) { if (a == 0) return b; if (b == 0) return a; int temp; while (b != 0) { temp = a & b; a = a ^ b; b = temp << 1; } return a; }   }
SumTwoIntegerSolution { static int sum(int a, int b) { if (a == 0) return b; if (b == 0) return a; int temp; while (b != 0) { temp = a & b; a = a ^ b; b = temp << 1; } return a; }    }