double round(double val, int scale, int roundingMethod)
Rounds the given value to the specified number of decimal places. The value is rounded using the given method which is any method defined in java.math.BigDecimal. BigDecimal values are:
ROUND_UP = 0, Rounding mode to round away from zero.
ROUND_DOWN = 1, Rounding mode to round towards zero.
ROUND_CEILING = 2, Rounding mode to round towards positive infinity.
ROUND_FLOOR = 3, Rounding mode to round towards negative infinity.
ROUND_HALF_UP = 4, Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round up.
ROUND_HALF_DOWN = 5, Rounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round down.
Input Parameters
val | Integer The value to round. |
scale | Integer The number of digits to the right of the decimal point. |
roundingMethod | Integer Rounding method as defined in BigDecimal. |
Return Value
Integer The rounded value. |