public static boolean isPowerOfTwo(int number) {
        return (number > 0) && (number & (number - 1)) == 0;
    }
Returns true if the number is a power of 2 (2,4,8,16...)

A good implementation found on the Java boards. note: a number is a power
of two if and only if it is the smallest number with that number of
significant bits. Therefore, if you subtract 1, you know that the new
number will have fewer bits, so ANDing the original number with anything
less than it will give 0.

@param number
           The number to test.
@return True if it is a power of two.
jme3-core/src/main/java/com/jme3/math/FastMath.java