Uses of Enum Class
java.math.RoundingMode
Package
Description
Provides classes for performing arbitrary-precision integer
arithmetic (
BigInteger
) and arbitrary-precision decimal
arithmetic (BigDecimal
).Provides classes and interfaces for handling text, dates, numbers,
and messages in a manner independent of natural languages.
-
Uses of RoundingMode in java.math
Modifier and TypeClassDescriptionenum
Specifies a rounding policy for numerical operations capable of discarding precision.Modifier and TypeMethodDescriptionMathContext.getRoundingMode()
Returns the roundingMode setting.static RoundingMode
RoundingMode.valueOf
(int rm) Returns theRoundingMode
object corresponding to a legacy integer rounding mode constant inBigDecimal
.static RoundingMode
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.Modifier and TypeMethodDescriptionBigDecimal.divide
(BigDecimal divisor, int scale, RoundingMode roundingMode) Returns aBigDecimal
whose value is(this / divisor)
, and whose scale is as specified.BigDecimal.divide
(BigDecimal divisor, RoundingMode roundingMode) Returns aBigDecimal
whose value is(this / divisor)
, and whose scale isthis.scale()
.BigDecimal.setScale
(int newScale, RoundingMode roundingMode) Returns aBigDecimal
whose scale is the specified value, and whose unscaled value is determined by multiplying or dividing thisBigDecimal
's unscaled value by the appropriate power of ten to maintain its overall value.ModifierConstructorDescriptionMathContext
(int setPrecision, RoundingMode setRoundingMode) Constructs a newMathContext
with a specified precision and rounding mode. -
Uses of RoundingMode in java.text
Modifier and TypeMethodDescriptionCompactNumberFormat.getRoundingMode()
Gets theRoundingMode
used in thisCompactNumberFormat
.DecimalFormat.getRoundingMode()
Gets theRoundingMode
used in this DecimalFormat.NumberFormat.getRoundingMode()
Gets theRoundingMode
used in this NumberFormat.Modifier and TypeMethodDescriptionvoid
CompactNumberFormat.setRoundingMode
(RoundingMode roundingMode) Sets theRoundingMode
used in thisCompactNumberFormat
.void
DecimalFormat.setRoundingMode
(RoundingMode roundingMode) Sets theRoundingMode
used in this DecimalFormat.void
NumberFormat.setRoundingMode
(RoundingMode roundingMode) Sets theRoundingMode
used in this NumberFormat.