@@ -0,0 +1,901 @@
+package main.algorithm.a.jian.zhi.offer;%0A%0A/**%0A * Title : main.algorithm.a.jian.zhi.offer %3Cbr%3E%0A * Description :%0A *  %3Cp%3E%0A *  %3Cul%3E %0A *      %3Cli%3E%0A *  %3C/ul%3E%0A * @author chile%0A * @version 1.0%0A * @date 2018/5/9 17:04%0A */%0Apublic class Count1InBinaryOrder %7B%0A%0A    private static int count(int n) %7B%0A        int count = 0;%0A        while (n != 0) %7B%0A            count++;%0A            n = n & (n - 1);%0A        %7D%0A        return count;%0A    %7D%0A%0A    private static int count1(int n) %7B%0A        int count = 0;%0A        int flag  = 1;%0A        while (flag != 0) %7B%0A            if ((n & flag) != 0) %7B%0A                count++;%0A            %7D%0A            flag %3C%3C= 1;%0A        %7D%0A        return count;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        //  10 : 0000 0000 0000 0000 0000 0000 0000 1010%0A        // -10 : 1111 1111 1111 1111 1111 1111 1111 0101%0A        int c = count1(-10);%0A        System.out.println(c);%0A    %7D%0A%7D%0A

count number of 1 in a binary order