Java 代码
class Solution {
public int add(int num1, int num2) {
int res = num1 ^ num2;
int carry = (num1 & num2) << 1;
while(carry != 0){
int result = carry ^ res;
carry = (carry & res) << 1;
res =result;
}
return res;
}
}