File-By-File
Rounding

Rounding

This class provides utilities for rounding numbers. You can change the default number of decimal places for rounding by modifying DEFAULT_PLACES (which is 3 by default).

Fields

DEFAULT_PLACES

The default number of decimal places to round to (currently 3).

Methods

roundInt(double value)

Rounds a double value to the nearest integer.

round(double value, int places)

Deprecated: Use fastRound(double, int) instead.

Rounds a double value to a specified number of decimal places using BigDecimal for precision. Throws an IllegalArgumentException if places is negative.

round(double value)

Deprecated: Use fastRound(double) instead.

Rounds a double value to the DEFAULT_PLACES (3 decimal places).

fastRound(double value, int places)

Quickly rounds a double value to a specific number of decimal places using Math.round(). This method is generally faster than the BigDecimal based round() methods.

fastRound(double value)

Quickly rounds a double value to the DEFAULT_PLACES (3 decimal places).