MCPcopy Create free account
hub / github.com/apna-college/Alpha / isPowerof2

Method isPowerof2

5_Bit Manipulation/BitOperations.java:50–52  ·  view source on GitHub ↗
(int n)

Source from the content-addressed store, hash-verified

48
49 //Check if number is power of 2 or not
50 public static boolean isPowerof2(int n) {
51 return (n & (n-1)) == 0;
52 }
53
54 //Count number of set bits
55 public static int countSetBits(int n) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected