class Solution {
public:
     int  NumberOf1(int n) {
         const int ref = 1 << 32;
         int counter = 0;
         while(n != 0)
         {
            if( n& ref ) counter++;
            n = n << 1;
         }
         return counter;
     }
};
//与2^31次方的最高位做 &运算,并每次做完&运算后将数据左移一位。