Uses of Class
java.math.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
Methods in java.math that return RoundingMode Modifier and Type Method Description RoundingModeMathContext. getRoundingMode()Returns the roundingMode setting.static RoundingModeRoundingMode. valueOf(int rm)Returns theRoundingModeobject corresponding to a legacy integer rounding mode constant inBigDecimal.static RoundingModeRoundingMode. valueOf(String name)Returns the enum constant of this type with the specified name.static RoundingMode[]RoundingMode. values()Returns an array containing the constants of this enum type, in the order they are declared.Methods in java.math with parameters of type RoundingMode Modifier and Type Method Description BigDecimalBigDecimal. divide(BigDecimal divisor, int scale, RoundingMode roundingMode)Returns aBigDecimalwhose value is(this / divisor), and whose scale is as specified.BigDecimalBigDecimal. divide(BigDecimal divisor, RoundingMode roundingMode)Returns aBigDecimalwhose value is(this / divisor), and whose scale isthis.scale().BigDecimalBigDecimal. setScale(int newScale, RoundingMode roundingMode)Returns aBigDecimalwhose 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.Constructors in java.math with parameters of type RoundingMode Constructor Description MathContext(int setPrecision, RoundingMode setRoundingMode)Constructs a newMathContextwith a specified precision and rounding mode. -
Uses of RoundingMode in java.text
Methods in java.text that return RoundingMode Modifier and Type Method Description RoundingModeCompactNumberFormat. getRoundingMode()Gets theRoundingModeused in thisCompactNumberFormat.RoundingModeDecimalFormat. getRoundingMode()Gets theRoundingModeused in this DecimalFormat.RoundingModeNumberFormat. getRoundingMode()Gets theRoundingModeused in this NumberFormat.Methods in java.text with parameters of type RoundingMode Modifier and Type Method Description voidCompactNumberFormat. setRoundingMode(RoundingMode roundingMode)Sets theRoundingModeused in thisCompactNumberFormat.voidDecimalFormat. setRoundingMode(RoundingMode roundingMode)Sets theRoundingModeused in this DecimalFormat.voidNumberFormat. setRoundingMode(RoundingMode roundingMode)Sets theRoundingModeused in this NumberFormat.