| Package | Description | 
|---|---|
| java.math | Provides classes for performing arbitrary-precision integer
 arithmetic ( BigInteger) and arbitrary-precision decimal
 arithmetic (BigDecimal). | 
| Modifier and Type | Field and Description | 
|---|---|
| static MathContext  | MathContext. DECIMAL128 A  MathContextobject with a precision setting
 matching the IEEE 754R Decimal128 format, 34 digits, and a
 rounding mode ofHALF_EVEN, the
 IEEE 754R default. | 
| static MathContext  | MathContext. DECIMAL32 A  MathContextobject with a precision setting
 matching the IEEE 754R Decimal32 format, 7 digits, and a
 rounding mode ofHALF_EVEN, the
 IEEE 754R default. | 
| static MathContext  | MathContext. DECIMAL64 A  MathContextobject with a precision setting
 matching the IEEE 754R Decimal64 format, 16 digits, and a
 rounding mode ofHALF_EVEN, the
 IEEE 754R default. | 
| static MathContext  | MathContext. UNLIMITED A  MathContextobject whose settings have the values
 required for unlimited precision arithmetic. | 
| Modifier and Type | Method and Description | 
|---|---|
| BigDecimal  | BigDecimal. abs (MathContext mc)Returns a  BigDecimalwhose value is the absolute value
 of thisBigDecimal, with rounding according to the
 context settings. | 
| BigDecimal  | BigDecimal. add (BigDecimal augend,
 MathContext mc)Returns a  BigDecimalwhose value is(this + augend),
 with rounding according to the context settings. | 
| BigDecimal  | BigDecimal. divide (BigDecimal divisor,
 MathContext mc)Returns a  BigDecimalwhose value is(this /
 divisor), with rounding according to the context settings. | 
| BigDecimal[] | BigDecimal. divideAndRemainder (BigDecimal divisor,
 MathContext mc)Returns a two-element  BigDecimalarray containing the
 result ofdivideToIntegralValuefollowed by the result ofremainderon the two operands calculated with rounding
 according to the context settings. | 
| BigDecimal  | BigDecimal. divideToIntegralValue (BigDecimal divisor,
 MathContext mc)Returns a  BigDecimalwhose value is the integer part
 of(this / divisor). | 
| BigDecimal  | BigDecimal. multiply (BigDecimal multiplicand,
 MathContext mc)Returns a  BigDecimalwhose value is (this ×
 multiplicand), with rounding according to the context settings. | 
| BigDecimal  | BigDecimal. negate (MathContext mc)Returns a  BigDecimalwhose value is(-this),
 with rounding according to the context settings. | 
| BigDecimal  | BigDecimal. plus (MathContext mc)Returns a  BigDecimalwhose value is(+this),
 with rounding according to the context settings. | 
| BigDecimal  | BigDecimal. pow (int n,
 MathContext mc)Returns a  BigDecimalwhose value is
 (thisn). | 
| BigDecimal  | BigDecimal. remainder (BigDecimal divisor,
 MathContext mc)Returns a  BigDecimalwhose value is(this %
 divisor), with rounding according to the context settings. | 
| BigDecimal  | BigDecimal. round (MathContext mc)Returns a  BigDecimalrounded according to theMathContextsettings. | 
| BigDecimal  | BigDecimal. subtract (BigDecimal subtrahend,
 MathContext mc)Returns a  BigDecimalwhose value is(this - subtrahend),
 with rounding according to the context settings. | 
| Constructor and Description | 
|---|
| BigDecimal (BigInteger unscaledVal,
 int scale,
 MathContext mc)Translates a  BigIntegerunscaled value and anintscale into aBigDecimal, with rounding
 according to the context settings. | 
| BigDecimal (BigInteger val,
 MathContext mc)Translates a  BigIntegerinto aBigDecimalrounding according to the context settings. | 
| BigDecimal (char[] in,
 int offset,
 int len,
 MathContext mc)Translates a character array representation of a
  BigDecimalinto aBigDecimal, accepting the
 same sequence of characters as theBigDecimal.BigDecimal(String)constructor, while allowing a sub-array to be specified and
 with rounding according to the context settings. | 
| BigDecimal (char[] in,
 MathContext mc)Translates a character array representation of a
  BigDecimalinto aBigDecimal, accepting the
 same sequence of characters as theBigDecimal.BigDecimal(String)constructor and with rounding according to the context
 settings. | 
| BigDecimal (double val,
 MathContext mc)Translates a  doubleinto aBigDecimal, with
 rounding according to the context settings. | 
| BigDecimal (int val,
 MathContext mc)Translates an  intinto aBigDecimal, with
 rounding according to the context settings. | 
| BigDecimal (long val,
 MathContext mc)Translates a  longinto aBigDecimal, with
 rounding according to the context settings. | 
| BigDecimal (String val,
 MathContext mc)Translates the string representation of a  BigDecimalinto aBigDecimal, accepting the same strings as theBigDecimal.BigDecimal(String)constructor, with rounding
 according to the context settings. | 
 Submit a bug or feature 
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2020, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy. 
Scripting on this page tracks web page traffic, but does not change the content in any way.