```
public class Solution {
public int getSum(int a, int b) {
int mask, res = 0, carry = 0;
for(mask = 1; mask != 0; mask <<= 1, carry <<= 1) {
res |= (a&mask)^(b&mask)^carry;
carry = carry&a | carry&b | a&b&mask;
}
return res;
}
}
```