Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

count number of set bits in number java

public static int countSetBits(long number){
        int count = 0;
        while(number>0){
            ++count;
            number &= number-1;
        }
        return count;
}
Source by javarevisited.blogspot.com #
 
PREVIOUS NEXT
Tagged: #count #number #set #bits #number #java
ADD COMMENT
Topic
Name
4+4 =