3.比特位计数

class Solution {
public int[] countBits(int n) {
int[] bites = new int[n + 1];
for(int i = 0 ; i <= n;i++){
bites[i] = Count(i);
}
return bites;
}
public int Count(int x){
int count = 0;
while(x > 0){
x &= (x - 1);
count++;
}
return count;
}
}