Answers for "find if element is powers of 2"

0

find if element is powers of 2

/** Check if a number is a power of 2 or not.
     *  IF n is power of 2, return 1, else return 0.
     */
    int powerOfTwo(int n)
    {
        return n && (!(n & (n-1)));
    }
Posted by: Guest on February-01-2021
0

find if element is powers of 2

powers of 2
Posted by: Guest on February-01-2021

Code answers related to "find if element is powers of 2"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language