1.5 输出整数N的二进制1的个数(递归)

    public static int getOne(int n){
        if(n <2){
            return n;
        }else{
            return ((n % 2)+getOne(n/2));
        }
    }

 

posted on 2015-03-28 16:20  爱踢小菜  阅读(196)  评论(0编辑  收藏  举报

导航