## Uses of Class
java.math.BigDecimal

- Packages that use BigDecimal
  Package | Description
  --- | ---
  java.math | Provides classes for performing arbitrary-precision integer arithmetic (`BigInteger`) and arbitrary-precision decimal arithmetic (`BigDecimal`).
  java.sql | Provides the API for accessing and processing data stored in a data source (usually a relational database) using the JavaTM programming language.
  java.util | Contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes (a string tokenizer, a random-number generator, and a bit array).
  javax.management.openmbean | Provides the open data types and Open MBean descriptor classes.
  javax.sql | Provides the API for server side data source access and processing from the JavaTM programming language.
  javax.sql.rowset | Standard interfaces and base classes for JDBC `RowSet` implementations.
  javax.sql.rowset.serial | Provides utility classes to allow serializable mappings between SQL types and data types in the Java programming language.
  javax.xml.bind | Provides a runtime binding framework for client applications including unmarshalling, marshalling, and validation capabilities.
  javax.xml.datatype | XML/Java Type Mappings.
  org.omg.CORBA | Provides the mapping of the OMG CORBA APIs to the JavaTM programming language, including the class `ORB`, which is implemented so that a programmer can use it as a fully-functional Object Request Broker (ORB).
  org.omg.CORBA.portable | Provides a portability layer, that is, a set of ORB APIs that makes it possible for code generated by one vendor to run on another vendor's ORB.

- - ### Uses of BigDecimal in java.math

    Fields in java.math declared as BigDecimal
    Modifier and Type | Field and Description
    --- | ---
    `static BigDecimal` | BigDecimal.`ONE` The value 1, with a scale of 0.
    `static BigDecimal` | BigDecimal.`TEN` The value 10, with a scale of 0.
    `static BigDecimal` | BigDecimal.`ZERO` The value 0, with a scale of 0.

    Methods in java.math that return BigDecimal
    Modifier and Type | Method and Description
    --- | ---
    `BigDecimal` | BigDecimal.`abs()` Returns a `BigDecimal` whose value is the absolute value of this `BigDecimal`, and whose scale is `this.scale()`.
    `BigDecimal` | BigDecimal.`abs(MathContext mc)` Returns a `BigDecimal` whose value is the absolute value of this `BigDecimal`, with rounding according to the context settings.
    `BigDecimal` | BigDecimal.`add(BigDecimal augend)` Returns a `BigDecimal` whose value is `(this + augend)`, and whose scale is `max(this.scale(), augend.scale())`.
    `BigDecimal` | BigDecimal.`add(BigDecimal augend, MathContext mc)` Returns a `BigDecimal` whose value is `(this + augend)`, with rounding according to the context settings.
    `BigDecimal` | BigDecimal.`divide(BigDecimal divisor)` Returns a `BigDecimal` whose value is `(this / divisor)`, and whose preferred scale is `(this.scale() - divisor.scale())`; if the exact quotient cannot be represented (because it has a non-terminating decimal expansion) an `ArithmeticException` is thrown.
    `BigDecimal` | BigDecimal.`divide(BigDecimal divisor, int roundingMode)` Returns a `BigDecimal` whose value is `(this / divisor)`, and whose scale is `this.scale()`.
    `BigDecimal` | BigDecimal.`divide(BigDecimal divisor, int scale, int roundingMode)` Returns a `BigDecimal` whose value is `(this / divisor)`, and whose scale is as specified.
    `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, MathContext mc)` Returns a `BigDecimal` whose value is `(this / divisor)`, with rounding according to the context settings.
    `BigDecimal` | BigDecimal.`divide(BigDecimal divisor, RoundingMode roundingMode)` Returns a `BigDecimal` whose value is `(this / divisor)`, and whose scale is `this.scale()`.
    `BigDecimal[]` | BigDecimal.`divideAndRemainder(BigDecimal divisor)` Returns a two-element `BigDecimal` array containing the result of `divideToIntegralValue` followed by the result of `remainder` on the two operands.
    `BigDecimal[]` | BigDecimal.`divideAndRemainder(BigDecimal divisor, MathContext mc)` Returns a two-element `BigDecimal` array containing the result of `divideToIntegralValue` followed by the result of `remainder` on the two operands calculated with rounding according to the context settings.
    `BigDecimal` | BigDecimal.`divideToIntegralValue(BigDecimal divisor)` Returns a `BigDecimal` whose value is the integer part of the quotient `(this / divisor)` rounded down.
    `BigDecimal` | BigDecimal.`divideToIntegralValue(BigDecimal divisor, MathContext mc)` Returns a `BigDecimal` whose value is the integer part of `(this / divisor)`.
    `BigDecimal` | BigDecimal.`max(BigDecimal val)` Returns the maximum of this `BigDecimal` and `val`.
    `BigDecimal` | BigDecimal.`min(BigDecimal val)` Returns the minimum of this `BigDecimal` and `val`.
    `BigDecimal` | BigDecimal.`movePointLeft(int n)` Returns a `BigDecimal` which is equivalent to this one with the decimal point moved `n` places to the left.
    `BigDecimal` | BigDecimal.`movePointRight(int n)` Returns a `BigDecimal` which is equivalent to this one with the decimal point moved `n` places to the right.
    `BigDecimal` | BigDecimal.`multiply(BigDecimal multiplicand)` Returns a `BigDecimal` whose value is `(this × multiplicand)`, and whose scale is `(this.scale() + multiplicand.scale())`.
    `BigDecimal` | BigDecimal.`multiply(BigDecimal multiplicand, MathContext mc)` Returns a `BigDecimal` whose value is `(this × multiplicand)`, with rounding according to the context settings.
    `BigDecimal` | BigDecimal.`negate()` Returns a `BigDecimal` whose value is `(-this)`, and whose scale is `this.scale()`.
    `BigDecimal` | BigDecimal.`negate(MathContext mc)` Returns a `BigDecimal` whose value is `(-this)`, with rounding according to the context settings.
    `BigDecimal` | BigDecimal.`plus()` Returns a `BigDecimal` whose value is `(+this)`, and whose scale is `this.scale()`.
    `BigDecimal` | BigDecimal.`plus(MathContext mc)` Returns a `BigDecimal` whose value is `(+this)`, with rounding according to the context settings.
    `BigDecimal` | BigDecimal.`pow(int n)` Returns a `BigDecimal` whose value is `(thisn)`, The power is computed exactly, to unlimited precision.
    `BigDecimal` | BigDecimal.`pow(int n, MathContext mc)` Returns a `BigDecimal` whose value is `(thisn)`.
    `BigDecimal` | BigDecimal.`remainder(BigDecimal divisor)` Returns a `BigDecimal` whose value is `(this % divisor)`.
    `BigDecimal` | BigDecimal.`remainder(BigDecimal divisor, MathContext mc)` Returns a `BigDecimal` whose value is `(this % divisor)`, with rounding according to the context settings.
    `BigDecimal` | BigDecimal.`round(MathContext mc)` Returns a `BigDecimal` rounded according to the `MathContext` settings.
    `BigDecimal` | BigDecimal.`scaleByPowerOfTen(int n)` Returns a BigDecimal whose numerical value is equal to (`this` * 10n).
    `BigDecimal` | BigDecimal.`setScale(int newScale)` Returns a `BigDecimal` whose scale is the specified value, and whose value is numerically equal to this `BigDecimal`'s.
    `BigDecimal` | BigDecimal.`setScale(int newScale, int 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.
    `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.
    `BigDecimal` | BigDecimal.`stripTrailingZeros()` Returns a `BigDecimal` which is numerically equal to this one but with any trailing zeros removed from the representation.
    `BigDecimal` | BigDecimal.`subtract(BigDecimal subtrahend)` Returns a `BigDecimal` whose value is `(this - subtrahend)`, and whose scale is `max(this.scale(), subtrahend.scale())`.
    `BigDecimal` | BigDecimal.`subtract(BigDecimal subtrahend, MathContext mc)` Returns a `BigDecimal` whose value is `(this - subtrahend)`, with rounding according to the context settings.
    `BigDecimal` | BigDecimal.`ulp()` Returns the size of an ulp, a unit in the last place, of this `BigDecimal`.
    `static BigDecimal` | BigDecimal.`valueOf(double val)` Translates a `double` into a `BigDecimal`, using the `double`'s canonical string representation provided by the `Double.toString(double)` method.
    `static BigDecimal` | BigDecimal.`valueOf(long val)` Translates a `long` value into a `BigDecimal` with a scale of zero.
    `static BigDecimal` | BigDecimal.`valueOf(long unscaledVal, int scale)` Translates a `long` unscaled value and an `int` scale into a `BigDecimal`.

    Methods in java.math with parameters of type BigDecimal
    Modifier and Type | Method and Description
    --- | ---
    `BigDecimal` | BigDecimal.`add(BigDecimal augend)` Returns a `BigDecimal` whose value is `(this + augend)`, and whose scale is `max(this.scale(), augend.scale())`.
    `BigDecimal` | BigDecimal.`add(BigDecimal augend, MathContext mc)` Returns a `BigDecimal` whose value is `(this + augend)`, with rounding according to the context settings.
    `int` | BigDecimal.`compareTo(BigDecimal val)` Compares this `BigDecimal` with the specified `BigDecimal`.
    `BigDecimal` | BigDecimal.`divide(BigDecimal divisor)` Returns a `BigDecimal` whose value is `(this / divisor)`, and whose preferred scale is `(this.scale() - divisor.scale())`; if the exact quotient cannot be represented (because it has a non-terminating decimal expansion) an `ArithmeticException` is thrown.
    `BigDecimal` | BigDecimal.`divide(BigDecimal divisor, int roundingMode)` Returns a `BigDecimal` whose value is `(this / divisor)`, and whose scale is `this.scale()`.
    `BigDecimal` | BigDecimal.`divide(BigDecimal divisor, int scale, int roundingMode)` Returns a `BigDecimal` whose value is `(this / divisor)`, and whose scale is as specified.
    `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, MathContext mc)` Returns a `BigDecimal` whose value is `(this / divisor)`, with rounding according to the context settings.
    `BigDecimal` | BigDecimal.`divide(BigDecimal divisor, RoundingMode roundingMode)` Returns a `BigDecimal` whose value is `(this / divisor)`, and whose scale is `this.scale()`.
    `BigDecimal[]` | BigDecimal.`divideAndRemainder(BigDecimal divisor)` Returns a two-element `BigDecimal` array containing the result of `divideToIntegralValue` followed by the result of `remainder` on the two operands.
    `BigDecimal[]` | BigDecimal.`divideAndRemainder(BigDecimal divisor, MathContext mc)` Returns a two-element `BigDecimal` array containing the result of `divideToIntegralValue` followed by the result of `remainder` on the two operands calculated with rounding according to the context settings.
    `BigDecimal` | BigDecimal.`divideToIntegralValue(BigDecimal divisor)` Returns a `BigDecimal` whose value is the integer part of the quotient `(this / divisor)` rounded down.
    `BigDecimal` | BigDecimal.`divideToIntegralValue(BigDecimal divisor, MathContext mc)` Returns a `BigDecimal` whose value is the integer part of `(this / divisor)`.
    `BigDecimal` | BigDecimal.`max(BigDecimal val)` Returns the maximum of this `BigDecimal` and `val`.
    `BigDecimal` | BigDecimal.`min(BigDecimal val)` Returns the minimum of this `BigDecimal` and `val`.
    `BigDecimal` | BigDecimal.`multiply(BigDecimal multiplicand)` Returns a `BigDecimal` whose value is `(this × multiplicand)`, and whose scale is `(this.scale() + multiplicand.scale())`.
    `BigDecimal` | BigDecimal.`multiply(BigDecimal multiplicand, MathContext mc)` Returns a `BigDecimal` whose value is `(this × multiplicand)`, with rounding according to the context settings.
    `BigDecimal` | BigDecimal.`remainder(BigDecimal divisor)` Returns a `BigDecimal` whose value is `(this % divisor)`.
    `BigDecimal` | BigDecimal.`remainder(BigDecimal divisor, MathContext mc)` Returns a `BigDecimal` whose value is `(this % divisor)`, with rounding according to the context settings.
    `BigDecimal` | BigDecimal.`subtract(BigDecimal subtrahend)` Returns a `BigDecimal` whose value is `(this - subtrahend)`, and whose scale is `max(this.scale(), subtrahend.scale())`.
    `BigDecimal` | BigDecimal.`subtract(BigDecimal subtrahend, MathContext mc)` Returns a `BigDecimal` whose value is `(this - subtrahend)`, with rounding according to the context settings.

  - ### Uses of BigDecimal in java.sql

    Methods in java.sql that return BigDecimal
    Modifier and Type | Method and Description
    --- | ---
    `BigDecimal` | CallableStatement.`getBigDecimal(int parameterIndex)` Retrieves the value of the designated JDBC `NUMERIC` parameter as a `java.math.BigDecimal` object with as many digits to the right of the decimal point as the value contains.
    `BigDecimal` | ResultSet.`getBigDecimal(int columnIndex)` Retrieves the value of the designated column in the current row of this `ResultSet` object as a `java.math.BigDecimal` with full precision.
    `BigDecimal` | CallableStatement.`getBigDecimal(int parameterIndex, int scale)` Deprecated. use `getBigDecimal(int parameterIndex)` or `getBigDecimal(String parameterName)`
    `BigDecimal` | ResultSet.`getBigDecimal(int columnIndex, int scale)` Deprecated. Use `getBigDecimal(int columnIndex)` or `getBigDecimal(String columnLabel)`
    `BigDecimal` | CallableStatement.`getBigDecimal(String parameterName)` Retrieves the value of a JDBC `NUMERIC` parameter as a `java.math.BigDecimal` object with as many digits to the right of the decimal point as the value contains.
    `BigDecimal` | ResultSet.`getBigDecimal(String columnLabel)` Retrieves the value of the designated column in the current row of this `ResultSet` object as a `java.math.BigDecimal` with full precision.
    `BigDecimal` | ResultSet.`getBigDecimal(String columnLabel, int scale)` Deprecated. Use `getBigDecimal(int columnIndex)` or `getBigDecimal(String columnLabel)`
    `BigDecimal` | SQLInput.`readBigDecimal()` Reads the next attribute in the stream and returns it as a `java.math.BigDecimal` object in the Java programming language.

    Methods in java.sql with parameters of type BigDecimal
    Modifier and Type | Method and Description
    --- | ---
    `void` | PreparedStatement.`setBigDecimal(int parameterIndex, BigDecimal x)` Sets the designated parameter to the given `java.math.BigDecimal` value.
    `void` | CallableStatement.`setBigDecimal(String parameterName, BigDecimal x)` Sets the designated parameter to the given `java.math.BigDecimal` value.
    `void` | ResultSet.`updateBigDecimal(int columnIndex, BigDecimal x)` Updates the designated column with a `java.math.BigDecimal` value.
    `void` | ResultSet.`updateBigDecimal(String columnLabel, BigDecimal x)` Updates the designated column with a `java.sql.BigDecimal` value.
    `void` | SQLOutput.`writeBigDecimal(BigDecimal x)` Writes the next attribute to the stream as a java.math.BigDecimal object.

  - ### Uses of BigDecimal in java.util

    Methods in java.util that return BigDecimal
    Modifier and Type | Method and Description
    --- | ---
    `BigDecimal` | Scanner.`nextBigDecimal()` Scans the next token of the input as a `BigDecimal`.

  - ### Uses of BigDecimal in javax.management.openmbean

    Fields in javax.management.openmbean with type parameters of type BigDecimal
    Modifier and Type | Field and Description
    --- | ---
    `static SimpleType<BigDecimal>` | SimpleType.`BIGDECIMAL` The `SimpleType` instance describing values whose Java class name is `java.math.BigDecimal`.

  - ### Uses of BigDecimal in javax.sql

    Methods in javax.sql with parameters of type BigDecimal
    Modifier and Type | Method and Description
    --- | ---
    `void` | RowSet.`setBigDecimal(int parameterIndex, BigDecimal x)` Sets the designated parameter in this `RowSet` object's command to the given `java.math.BigDeciaml` value.
    `void` | RowSet.`setBigDecimal(String parameterName, BigDecimal x)` Sets the designated parameter to the given `java.math.BigDecimal` value.

  - ### Uses of BigDecimal in javax.sql.rowset

    Methods in javax.sql.rowset with parameters of type BigDecimal
    Modifier and Type | Method and Description
    --- | ---
    `void` | BaseRowSet.`setBigDecimal(int parameterIndex, BigDecimal x)` Sets the designated parameter to the given `java.lang.BigDecimal` value.
    `void` | BaseRowSet.`setBigDecimal(String parameterName, BigDecimal x)` Sets the designated parameter to the given `java.math.BigDecimal` value.

  - ### Uses of BigDecimal in javax.sql.rowset.serial

    Methods in javax.sql.rowset.serial that return BigDecimal
    Modifier and Type | Method and Description
    --- | ---
    `BigDecimal` | SQLInputImpl.`readBigDecimal()` Retrieves the next attribute in this `SQLInputImpl` object as a `java.math.BigDecimal`.

    Methods in javax.sql.rowset.serial with parameters of type BigDecimal
    Modifier and Type | Method and Description
    --- | ---
    `void` | SQLOutputImpl.`writeBigDecimal(BigDecimal x)` Writes a `java.math.BigDecimal` object in the Java programming language to this `SQLOutputImpl` object.

  - ### Uses of BigDecimal in javax.xml.bind

    Methods in javax.xml.bind that return BigDecimal
    Modifier and Type | Method and Description
    --- | ---
    `BigDecimal` | DatatypeConverterInterface.`parseDecimal(String lexicalXSDDecimal)` Converts the string argument into a BigDecimal value.
    `static BigDecimal` | DatatypeConverter.`parseDecimal(String lexicalXSDDecimal)` Converts the string argument into a BigDecimal value.

    Methods in javax.xml.bind with parameters of type BigDecimal
    Modifier and Type | Method and Description
    --- | ---
    `String` | DatatypeConverterInterface.`printDecimal(BigDecimal val)` Converts a BigDecimal value into a string.
    `static String` | DatatypeConverter.`printDecimal(BigDecimal val)` Converts a BigDecimal value into a string.

  - ### Uses of BigDecimal in javax.xml.datatype

    Methods in javax.xml.datatype that return BigDecimal
    Modifier and Type | Method and Description
    --- | ---
    `abstract BigDecimal` | XMLGregorianCalendar.`getFractionalSecond()` Return fractional seconds.

    Methods in javax.xml.datatype with parameters of type BigDecimal
    Modifier and Type | Method and Description
    --- | ---
    `abstract Duration` | Duration.`multiply(BigDecimal factor)` Computes a new duration whose value is `factor` times longer than the value of this duration.
    `abstract Duration` | DatatypeFactory.`newDuration(boolean isPositive, BigInteger years, BigInteger months, BigInteger days, BigInteger hours, BigInteger minutes, BigDecimal seconds)` Obtain a new instance of a `Duration` specifying the `Duration` as isPositive, years, months, days, hours, minutes, seconds.
    `abstract XMLGregorianCalendar` | DatatypeFactory.`newXMLGregorianCalendar(BigInteger year, int month, int day, int hour, int minute, int second, BigDecimal fractionalSecond, int timezone)` Constructor allowing for complete value spaces allowed by W3C XML Schema 1.0 recommendation for xsd:dateTime and related builtin datatypes.
    `XMLGregorianCalendar` | DatatypeFactory.`newXMLGregorianCalendarTime(int hours, int minutes, int seconds, BigDecimal fractionalSecond, int timezone)` Create a Java instance of XML Schema builtin datatype time.
    `abstract void` | XMLGregorianCalendar.`setFractionalSecond(BigDecimal fractional)` Set fractional seconds.
    `void` | XMLGregorianCalendar.`setTime(int hour, int minute, int second, BigDecimal fractional)` Set time as one unit, including the optional infinite precision fractional seconds.

  - ### Uses of BigDecimal in org.omg.CORBA

    Fields in org.omg.CORBA declared as BigDecimal
    Modifier and Type | Field and Description
    --- | ---
    `BigDecimal` | FixedHolder.`value` The value held by the FixedHolder

    Methods in org.omg.CORBA that return BigDecimal
    Modifier and Type | Method and Description
    --- | ---
    `BigDecimal` | Any.`extract_fixed()` Extracts the `java.math.BigDecimal` object in this `Any` object's `value` field.

    Methods in org.omg.CORBA with parameters of type BigDecimal
    Modifier and Type | Method and Description
    --- | ---
    `void` | Any.`insert_fixed(BigDecimal value)` Throws an `org.omg.CORBA.NO_IMPLEMENT` exception.
    `void` | Any.`insert_fixed(BigDecimal value, TypeCode type)` Throws an `org.omg.CORBA.NO_IMPLEMENT` exception.

    Constructors in org.omg.CORBA with parameters of type BigDecimal
    Constructor and Description
    `FixedHolder(BigDecimal initial)` Construct the FixedHolder and initialize it with the given value.

  - ### Uses of BigDecimal in org.omg.CORBA.portable

    Methods in org.omg.CORBA.portable that return BigDecimal
    Modifier and Type | Method and Description
    --- | ---
    `BigDecimal` | InputStream.`read_fixed()` Reads a BigDecimal number.

    Methods in org.omg.CORBA.portable with parameters of type BigDecimal
    Modifier and Type | Method and Description
    --- | ---
    `void` | OutputStream.`write_fixed(BigDecimal value)` Writes a BigDecimal number.

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, 2016, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.