I Try to solve this problem using java and not in a bit view. I do like this:

int num=0;

int m;

while(n!=0){

m=n%2;

n=n/2;

if(m==1){

num++;

}

}

return num;

In actually,It is a mathematic way.it goes right in most situation,but the test case includes 2147483648,it is out of range in java.so the answer is wrong.

I want to know is there any way to solve this problem without using bit-operation (like &)?