# Uses of Enum Class
java.math.RoundingMode

Packages that use RoundingMode
Package
Description
java.math
Provides classes for performing arbitrary-precision integer arithmetic (`BigInteger`) and arbitrary-precision decimal arithmetic (`BigDecimal`).
java.text
Provides classes and interfaces for handling text, dates, numbers, and messages in a manner independent of natural languages.

## Uses of RoundingMode in java.math

Subclasses with type arguments of type RoundingMode in java.math
Modifier and Type
Class
Description
`enum`
`RoundingMode`
Specifies a rounding policy for numerical operations capable of discarding precision.
Methods in java.math that return RoundingMode
Modifier and Type
Method
Description
`RoundingMode`
MathContext.`getRoundingMode()`
Returns the roundingMode setting.
`static RoundingMode`
RoundingMode.`valueOf(int rm)`
Returns the `RoundingMode` object corresponding to a legacy integer rounding mode constant in `BigDecimal`.
`static RoundingMode`
RoundingMode.`valueOf(String name)`
Returns the enum constant of this class with the specified name.
`static RoundingMode[]`
RoundingMode.`values()`
Returns an array containing the constants of this enum class, in the order they are declared.
Methods in java.math with parameters of type RoundingMode
Modifier and Type
Method
Description
`BigDecimal`
BigDecimal.`divide(BigDecimal divisor, int scale, RoundingMode roundingMode)`
Returns a `BigDecimal` whose value is `(this / divisor)`, and whose scale is as specified.
`BigDecimal`
BigDecimal.`divide(BigDecimal divisor, RoundingMode roundingMode)`
Returns a `BigDecimal` whose value is `(this / divisor)`, and whose scale is `this.scale()`.
`BigDecimal`
BigDecimal.`setScale(int newScale, RoundingMode roundingMode)`
Returns a `BigDecimal` whose scale is the specified value, and whose unscaled value is determined by multiplying or dividing this `BigDecimal`'s unscaled value by the appropriate power of ten to maintain its overall value.
Constructors in java.math with parameters of type RoundingMode
Modifier
Constructor
Description
``
`MathContext(int setPrecision, RoundingMode setRoundingMode)`
Constructs a new `MathContext` with a specified precision and rounding mode.

## Uses of RoundingMode in java.text

Methods in java.text that return RoundingMode
Modifier and Type
Method
Description
`RoundingMode`
CompactNumberFormat.`getRoundingMode()`
Gets the `RoundingMode` used in this `CompactNumberFormat`.
`RoundingMode`
DecimalFormat.`getRoundingMode()`
Gets the `RoundingMode` used in this DecimalFormat.
`RoundingMode`
NumberFormat.`getRoundingMode()`
Gets the `RoundingMode` used in this NumberFormat.
Methods in java.text with parameters of type RoundingMode
Modifier and Type
Method
Description
`void`
CompactNumberFormat.`setRoundingMode(RoundingMode roundingMode)`
Sets the `RoundingMode` used in this `CompactNumberFormat`.
`void`
DecimalFormat.`setRoundingMode(RoundingMode roundingMode)`
Sets the `RoundingMode` used in this DecimalFormat.
`void`
NumberFormat.`setRoundingMode(RoundingMode roundingMode)`
Sets the `RoundingMode` used in this NumberFormat.