List of utility methods to do Number Round
int | roundToDimensions(int value, int nearestValue) Round. return Math.round(value / nearestValue) * nearestValue;
|
long | roundToEight(long i) Memory size of objects are rounded to multiple of 8 bytes return 8 * ((i + 7) / 8);
|
float | roundToHalf(float x) Round to half float. return (float) (Math.ceil(x * 2) / 2); |
int | roundToInt(double d) Round. return (int) Math.round(d); |
int | roundToInt(double d) round To Int return (int) Math.round(d); |
int | roundToInt(final double d) Rounds d to an int. return (int) (d + 0.5); |
float | roundToInterval(float num, float interval) round To Interval if (interval == 0f) return num; return (float) ((double) Math.round(num / interval) * interval); |
double | roundToMil(double val) round To Mil double r = val * 1000.0; int l = (int) r; if (r - l >= 0.5) l++; r = (double) l / 1000.0; return r; |
int | roundToMultiple(int value, int divisor) round To Multiple int rem = value % divisor; if (rem == 0) return (value); return (value + divisor - rem); |
int | roundToMultiple(int value, int multipleOf) Rounds a value to the nearest number that is a specific multiple. return (int) Math.round((double) value / multipleOf) * multipleOf; |