class Solution { public int NumberOf1(int n) { int re = 0; while (n != 0) { n &= n-1; re ++; } return re; } }