class Solution {
public int hammingDistance(int x, int y) {
int num = 0;
int temp = x^y;
while (temp != 0) {
temp = (temp - 1) & temp;
num++;
}
return num;
}
}
09-03
1072
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)