Java Utililty Methods Ceil

List of utility methods to do Ceil

Description

The list of methods to do Ceil are organized into topic(s).

Method

intceilingPow2(int n)
Converting the passed value to make sure we can use it for OpenGL.
int pow2 = 1;
while (n > pow2)
    pow2 = pow2 << 1;
return pow2;
intceilingPowerOf2(final int n)
Computes the ceiling power of 2 within the range [1, 2^30].
if (n <= 1) {
    return 1;
final int topPwrOf2 = 1 << 30;
return (n >= topPwrOf2) ? topPwrOf2 : Integer.highestOneBit((n - 1) << 1);
intceilingPowerOf2(int n)
Computes the ceiling power of 2 within the range [1, 2^30].
if (n <= 1) {
    return 1;
if (n >= IntTopPwrOf2) {
    return IntTopPwrOf2;
n--;
for (int i = 1; i <= MaxIntShifts; i <<= 1) {
...
intceilingPowerOfTwo(final int a)
ceiling Power Of Two
checkIsInRange(0, 1 << 30, a);
return a >= 2 ? Integer.highestOneBit(a - 1 << 1) : 1;
intceilingPowerOfTwo(int value)
Returns the smallest power of two number that is greater than or equal to value .
return 1 << -Integer.numberOfLeadingZeros(value - 1);
DoubleceilInt(Double d, double intv)
ceil Int
return floorInt(d, intv) + intv;
intceilInt(final double x)
Returns (int) Math.ceil(x).
return (int) Math.ceil(x);
intceilLogBaseTwo(final int i)
Returns the log base 2 of an integer, rounded to the ceiling.
checkPositiveInteger(i);
return 32 - Integer.numberOfLeadingZeros(i - 1);
intceilMaskPOT(int n)
ceil Mask POT
n |= n >>> 1;
n |= n >>> 2;
n |= n >>> 4;
n |= n >>> 8;
n |= n >>> 16;
return n;
floatceilMultiple(float source, float multiple)
ceil Multiple
if (source > 0) {
    float tmp = source - 1;
    return tmp + (multiple - (tmp % multiple));
} else {
    return source + (-source % multiple);