位运算比较薄弱,最后还是看别人的答案写出来的
参考资料:http://blog.csdn.net/cjt5047/article/details/50686724
public class Solution {
/**
* @param a: An integer
* @param b: An integer
* @return: The sum of a and b
*/
public int aplusb(int a, int b) {
// write your code here
if(a==0) return b;
if(b==0) return a;
int sum=a^b;
int m=(a&b)<<1;
return aplusb(sum,m);
}
}