public static int nearestPowerOfTwo(int number) {
        number--;
        number |= number >> 1;
        number |= number >> 2;
        number |= number >> 4;
        number |= number >> 8;
        number |= number >> 16;
        number++;
        number += (number == 0) ? 1 : 0;
        return number;
    }
Get the next power of two of the given number.

E.g. for an input 100, this returns 128.
Returns 1 for all numbers less than or equal to 1.

@param number The number to obtain the POT for.
@return The next power of two.
jme3-core/src/main/java/com/jme3/math/FastMath.java