1 将整数减一和原来的数相与,结果为0,运算多少次就有多少个1
public static void main(String[] args) {
int data = 3;
int count = 0;
while (data != 0) {
count++;
data = data & (data - 1);
}
System.out.println(count);
}