MCPcopy Create free account
hub / github.com/codedecks-in/LeetCode-Solutions / numberOfBits

Method numberOfBits

Java/number-complement.java:12–21  ·  view source on GitHub ↗

Method to find out the total number of bits in a number.

(int num)

Source from the content-addressed store, hash-verified

10 * Method to find out the total number of bits in a number.
11 **/
12 public static int numberOfBits(int num){
13 int countOfBits = 0;
14
15 while(num != 0){
16 num = num >> 1;
17 countOfBits++;
18 }
19
20 return countOfBits;
21 }
22}

Callers 1

findComplementMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected