List of utility methods to do Number Round
double | roundUp(double val) round Up int exponent = (int) Math.floor(Math.log10(val)); val *= Math.pow(10, -exponent); if (val > 5.0) val = 10.0; else if (val > 2.0) val = 5.0; else if (val > 1.0) val = 2.0; ... |
double | roundUp(double val) round Up int exponent = (int) Math.floor(Math.log10(val)); val *= Math.pow(10, -exponent); if (val > 5.0) val = 10.0; else if (val > 2.0) val = 5.0; else if (val > 1.0) val = 2.0; ... |
double | roundUp(final double val) Given a number, round up to the nearest power of ten times 1, 2, or 5. int exponent = (int) Math.floor(Math.log10(val)); double rval = val * Math.pow(10, -exponent); if (rval > 5.0) { rval = 10.0; } else if (rval > 2.0) { rval = 5.0; } else if (rval > 1.0) { rval = 2.0; ... |
int | roundUp(final int number, final int base) Rounds an integer division to the nearest integer. return (number + base - 1) / base;
|
long | RoundUp(final T number) Returns a long number by round up with specify number. Returns 0 if number == null. e.g: average is 3.5, then return 4. if (number == null) { return 0; double value = number.doubleValue(); if (value % 1 == 0) { return (long) value; } else { return (long) (value + 1); ... |
int | roundUp(int capacity) round Up int tz = 32 - Integer.numberOfLeadingZeros(capacity - 1); return 1 << tz; |
int | roundUp(int dividend, int divisor) round Up int remainder = dividend % divisor; dividend -= remainder; if (remainder * 2 > divisor) { dividend += divisor; return dividend; |
int | roundUp(int groupSize, int globalSize) round Up int r = globalSize % groupSize; if (r == 0) { return globalSize; } else { return globalSize + groupSize - r; |
int | roundUp(int groupSize, int globalSize) rounded up to the nearest multiple of the groupSize int r = globalSize % groupSize; if (r == 0) { return globalSize; } else { return globalSize + groupSize - r; |
int | roundUp(int i, int snap) round Up return roundDown(i + snap - 1, snap);
|