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

intceil(int f)
ceil
if ((f & 0xFFFF) == 0)
    return f;
return (f & ~0xFFFF) + (f < 0 ? 0 : 65536);
intceil(int number, int divisor)
ceil
assert divisor > 0;
int result = number / divisor + ((number % divisor) > 0 ? 1 : 0);
return result;
intceil(int x, int quantum)
Returns minimal possible integer, greater or equal than x, divisible by quantum.
int dx = (x < 0) || (x % quantum == 0) ? 0 : 1;
return (x / quantum + dx) * quantum;
longceil(long a, long b)
ceil
long r = a % b;
if (r > 0) {
    return a - r + b;
} else {
    return a - r;
voidCeil(Object in, int val)
Ceil
if (in == null)
    return;
if (in instanceof int[]) {
    int[] inn = (int[]) in;
    for (int i = 0, s = inn.length; i < s; i++)
        if (inn[i] > val)
            inn[i] = val;
} else {
...
doubleceil(Short a)
Ceil.
return Math.ceil(a.doubleValue());
doubleceil10(double a)
Returns the smallest (closest to negative infinity) double value that is a power of 10 not less than the argument.
return Math.pow(10, Math.ceil(log10(a)));
doubleceil2(double d, int p)
ceil
long tmp = (long) Math.pow(10, p);
double num = Math.ceil(d / tmp);
num *= tmp;
return num;
intceil2(int a, int preserveDigits)
Math#ceil(double) -like operation for integers preserving the given number of digits in contrary to MathUtil#ceil(int,int) where cut-of-digits are specified:
return ceil(a, getDigits(a) - preserveDigits)
return ceil(a, getDigits(a) - preserveDigits);
intceilDiv(int numerator, int denominator)
ceil Div
return (int) Math.ceil((double) numerator / denominator);