Write a function that add two numbers A and B. You should not use +
or any arithmetic operators.
分析:
典型的Bit Operation.
class Solution {
/*
* param a: The first integer
* param b: The second integer
* return: The sum of a and b
*/
public int aplusb(int a, int b) {
if (a == ) return b;
int sum = a ^ b;
int carry = (a & b) << ;
return aplusb(carry, sum);
}
};