List of utility methods to do Number Round
String | roundToString(double nb2round, int nbOfDigits) Round to string. if (nbOfDigits == 0) return "" + Math.round(nb2round); return new Double(round(nb2round, nbOfDigits)).toString(); |
int | roundToTop(float f) round To Top if (f > (int) f) return (int) (f + 1); return (int) f; |
long | roundToWord(long value) Return the smallest multiple of four (4) that is greater than or equal to the given value. return value + ROUND_UP_AMOUNT[(int) (value % 4)]; |
int | roundToZero(float x) round To Zero return (int) x; |
double | roundTwoDecimals(double value) Rounds the passed value to two decimals after decimal point. return round(value, 2);
|
int | roundUp(double a) Returns the closest int to the argument, with ties rounding up. return (int) Math.round(a); |
long | roundUp(double d) round Up return Math.round(d * 10.0) / 10;
|
int | roundUP(double d) round UP double dAbs = Math.abs(d); int i = (int) dAbs; double result = dAbs - (double) i; if (result == 0.0) { return (int) d; } else { return (int) d < 0 ? -(i + 1) : i + 1; |
int | roundUp(double n) Round the given number to the nearest whole that is greater than the number. return roundDown(n) + 1;
|
double | roundUp(double n, int precision) Rounds up number with precise return (double) (Math.round(n * Math.pow(10, precision)) / Math.pow(10, precision)); |