Standard Java Solution
Theory\nWe take the + and - operation for granted when it comes to simple integer math. To fully understand this solution, you must understand the XOR, and << ,
### Theory\nWe take the `+` and `-` operation for granted when it comes to simple integer math. To fully understand this solution, you must understand the `XOR`, and `<<` , and `&` operators for bit manipulation. \n\nLets first consider an example:\na = 2, b = 3\naBinary = 10 and bBinary = 11\n\n011 (b)\n010 (a) +\n__\n001 <- This line is a ^ b (XOR)\n100 <- this line is the shifted version of the carry by 1 place left (a & b) << 1\n__\n101 <-- Our answer\n\nSo we can conclude that the sum `c` given two integers `a` and `b` will be `a ^ b` until our carry is zero. If the carry is not zero, we reassign it to integer `b`. Negatives don\'t need a special case, thats the beauty of this solution. If it took you a while to get this solution, don\'t worry, but once you understand it, its makes so much sense.\n\n### Solution Recursion\n```\n    public int getSum(int a, int b) {\n        if (a == 0) return b;\n        if (b == 0) return a;\n        return getSum(a ^ b, (a & b) << 1);\n    }\n```\n\n### Solution Iterative\n```\n    public int getSum(int a, int b) {\n        if (a == 0) return b;\n        if (b == 0) return a;\n        \n        while (b != 0)  {\n            int carry = (a & b) << 1;\n            a = a ^ b;\n            b = carry; // reassign the carry into b\n        }\n        return a;\n    }\n```\n\n
['Java']