https://blog.csdn.net/derrantcm/article/details/45476103
int totalOne(int n) {
int nInput = n >= 0 ? n : -n;
int total = 0;
while (nInput != 0) {
if(nInput % 2 == 1) {
total++;
}
nInput /=2;
}
return total;
}
int totalOneNew(int n) {
int nInput = n >= 0 ? n : -n;
int total = 0;
while (nInput != 0) {
nInput = nInput & (nInput-1);
total++;
}
return total;
}