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

intceilDiv(int v1, int v2)
ceil Div
return v1 / v2 + (((v1 % v2 != 0) && positiveProduct(v1, v2)) ? 1 : 0);
longceilDiv(long a, long b)
ceil(a/b) if a>=0
return (int) ((a + b - 1) / b);
intceilDivide(long a, long b)
ceil Divide
long c = a % b;
return (int) (a / b + (c > 0 ? 1 : 0));
intceilDivision(int value, int divisor)
ceil Division
return (value + (divisor - 1)) / divisor;
intceiling(double d)
ceiling
return (int) Math.ceil(d);
intceiling(double d)
ceiling
return Double.valueOf(Math.ceil(d)).intValue();
intceiling_float_int(float value)
ceilinfloaint
int i = (int) value;
return value > (float) i ? i + 1 : i;
intceilingAbs(double a)
Returns ceiling for absolute value of a, keeping the sign.
int ceil = (int) a;
if (a >= 0) {
    return a > (double) ceil ? ceil + 1 : ceil;
} else {
    return a < (double) ceil ? ceil - 1 : ceil;
intceilingHalf(int num)
Returns the ceiling of the half of the input value
if ((num & 1) == 1) {
    return (num + 1) / 2;
} else {
    return num / 2;
intceilingNextPowerOfTwo(final int x)
ceiling Next Power Of Two
return 1 << (32 - Integer.numberOfLeadingZeros(x - 1));