No need to iterate all 32 bits all the time, for the example provided, only 4 iterations required.

```
public int hammingWeight(int n) {
int result = 0;
while (n != 0) {
if ((n & 1) == 1) {
result++;
}
n >>>= 1;
}
return result;
}
```