List of utility methods to do Ceil
int | ceilDiv(int v1, int v2) ceil Div return v1 / v2 + (((v1 % v2 != 0) && positiveProduct(v1, v2)) ? 1 : 0);
|
long | ceilDiv(long a, long b) ceil(a/b) if a>=0 return (int) ((a + b - 1) / b); |
int | ceilDivide(long a, long b) ceil Divide long c = a % b; return (int) (a / b + (c > 0 ? 1 : 0)); |
int | ceilDivision(int value, int divisor) ceil Division return (value + (divisor - 1)) / divisor;
|
int | ceiling(double d) ceiling return (int) Math.ceil(d); |
int | ceiling(double d) ceiling return Double.valueOf(Math.ceil(d)).intValue();
|
int | ceiling_float_int(float value) ceilinfloaint int i = (int) value; return value > (float) i ? i + 1 : i; |
int | ceilingAbs(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; |
int | ceilingHalf(int num) Returns the ceiling of the half of the input value if ((num & 1) == 1) { return (num + 1) / 2; } else { return num / 2; |
int | ceilingNextPowerOfTwo(final int x) ceiling Next Power Of Two return 1 << (32 - Integer.numberOfLeadingZeros(x - 1));
|