private static int sum(int a, int b) {
while (b != 0){
int c = a & b;
int d = a | b;
a = d ^ c;
b = c << 1;
}
return a;
}
位运算求和
最新推荐文章于 2021-09-26 17:33:51 发布
private static int sum(int a, int b) {
while (b != 0){
int c = a & b;
int d = a | b;
a = d ^ c;
b = c << 1;
}
return a;
}