//求二进制中1的个数
public int countOne(int n){
int count=0;
while(n>0){
if(n&1==1){
count++;
}
n>>=1;
}
return count;
}
位运算-求二进制中1的个数
猜你喜欢
转载自blog.csdn.net/weixin_42146769/article/details/88531392
今日推荐
周排行