record/problems/number_of_1_bits/solution.java
<filename>record/problems/number_of_1_bits/solution.javapublic class Solution {
    // you need to treat n as an unsigned value
    public int hammingWeight(int n) {
        int cnt = 0;
        while (n != 0){
            cnt += n & 1;
            n >>>= 1;
        }
        return cnt;
    }
}