Uses of Class
java.math.BigDecimal
Packages that use BigDecimal
Package
Description
Provides classes for performing arbitrary-precision integer
arithmetic (
BigInteger) and arbitrary-precision decimal
arithmetic (BigDecimal).Provides the API for accessing and processing data stored in a
data source (usually a relational database) using the
Java programming language.
Contains the collections framework, some internationalization support classes,
a service loader, properties, random number generation, string parsing
and scanning classes, base64 encoding and decoding, a bit array, and
several miscellaneous utility classes.
Provides the open data types and Open MBean descriptor classes.
Provides the API for server side data source access and processing from
the Java programming language.
Standard interfaces and base classes for JDBC
RowSet
implementations.Provides utility classes to allow serializable mappings between SQL types
and data types in the Java programming language.
Defines XML/Java Type Mappings.
-
Uses of BigDecimal in java.math
Fields in java.math declared as BigDecimalModifier and TypeFieldDescriptionstatic final BigDecimalBigDecimal.ONEThe value 1, with a scale of 0.static final BigDecimalBigDecimal.TENThe value 10, with a scale of 0.static final BigDecimalBigDecimal.ZEROThe value 0, with a scale of 0.Methods in java.math that return BigDecimalModifier and TypeMethodDescriptionBigDecimal.abs()Returns aBigDecimalwhose value is the absolute value of thisBigDecimal, and whose scale isthis.scale().BigDecimal.abs(MathContext mc) Returns aBigDecimalwhose value is the absolute value of thisBigDecimal, with rounding according to the context settings.BigDecimal.add(BigDecimal augend) Returns aBigDecimalwhose value is(this + augend), and whose scale ismax(this.scale(), augend.scale()).BigDecimal.add(BigDecimal augend, MathContext mc) Returns aBigDecimalwhose value is(this + augend), with rounding according to the context settings.BigDecimal.divide(BigDecimal divisor) Returns aBigDecimalwhose 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) anArithmeticExceptionis thrown.BigDecimal.divide(BigDecimal divisor, int roundingMode) Deprecated.BigDecimal.divide(BigDecimal divisor, int scale, int roundingMode) Deprecated.The methoddivide(BigDecimal, int, RoundingMode)should be used in preference to this legacy method.BigDecimal.divide(BigDecimal divisor, int scale, RoundingMode roundingMode) Returns aBigDecimalwhose value is(this / divisor), and whose scale is as specified.BigDecimal.divide(BigDecimal divisor, MathContext mc) Returns aBigDecimalwhose value is(this / divisor), with rounding according to the context settings.BigDecimal.divide(BigDecimal divisor, RoundingMode roundingMode) Returns aBigDecimalwhose value is(this / divisor), and whose scale isthis.scale().BigDecimal.divideAndRemainder(BigDecimal divisor) Returns a two-elementBigDecimalarray containing the result ofdivideToIntegralValuefollowed by the result ofremainderon the two operands.BigDecimal.divideAndRemainder(BigDecimal divisor, MathContext mc) Returns a two-elementBigDecimalarray containing the result ofdivideToIntegralValuefollowed by the result ofremainderon the two operands calculated with rounding according to the context settings.BigDecimal.divideToIntegralValue(BigDecimal divisor) Returns aBigDecimalwhose value is the integer part of the quotient(this / divisor)rounded down.BigDecimal.divideToIntegralValue(BigDecimal divisor, MathContext mc) Returns aBigDecimalwhose value is the integer part of(this / divisor).BigDecimal.max(BigDecimal val) Returns the maximum of thisBigDecimalandval.BigDecimal.min(BigDecimal val) Returns the minimum of thisBigDecimalandval.BigDecimal.movePointLeft(int n) Returns aBigDecimalwhich is equivalent to this one with the decimal point movednplaces to the left.BigDecimal.movePointRight(int n) Returns aBigDecimalwhich is equivalent to this one with the decimal point movednplaces to the right.BigDecimal.multiply(BigDecimal multiplicand) Returns aBigDecimalwhose value is(this × multiplicand), and whose scale is(this.scale() + multiplicand.scale()).BigDecimal.multiply(BigDecimal multiplicand, MathContext mc) Returns aBigDecimalwhose value is(this × multiplicand), with rounding according to the context settings.BigDecimal.negate()Returns aBigDecimalwhose value is(-this), and whose scale isthis.scale().BigDecimal.negate(MathContext mc) Returns aBigDecimalwhose value is(-this), with rounding according to the context settings.BigDecimal.plus()Returns aBigDecimalwhose value is(+this), and whose scale isthis.scale().BigDecimal.plus(MathContext mc) Returns aBigDecimalwhose value is(+this), with rounding according to the context settings.BigDecimal.pow(int n) Returns aBigDecimalwhose value is(thisn), The power is computed exactly, to unlimited precision.BigDecimal.pow(int n, MathContext mc) Returns aBigDecimalwhose value is(thisn).BigDecimal.remainder(BigDecimal divisor) Returns aBigDecimalwhose value is(this % divisor).BigDecimal.remainder(BigDecimal divisor, MathContext mc) Returns aBigDecimalwhose value is(this % divisor), with rounding according to the context settings.BigDecimal.round(MathContext mc) Returns aBigDecimalrounded according to theMathContextsettings.BigDecimal.scaleByPowerOfTen(int n) Returns a BigDecimal whose numerical value is equal to (this* 10n).BigDecimal.setScale(int newScale) Returns aBigDecimalwhose scale is the specified value, and whose value is numerically equal to thisBigDecimal's.BigDecimal.setScale(int newScale, int roundingMode) Deprecated.The methodsetScale(int, RoundingMode)should be used in preference to this legacy method.BigDecimal.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.BigDecimal.sqrt(MathContext mc) Returns an approximation to the square root ofthiswith rounding according to the context settings.BigDecimal.stripTrailingZeros()Returns aBigDecimalwhich is numerically equal to this one but with any trailing zeros removed from the representation.BigDecimal.subtract(BigDecimal subtrahend) Returns aBigDecimalwhose value is(this - subtrahend), and whose scale ismax(this.scale(), subtrahend.scale()).BigDecimal.subtract(BigDecimal subtrahend, MathContext mc) Returns aBigDecimalwhose value is(this - subtrahend), with rounding according to the context settings.BigDecimal.ulp()Returns the size of an ulp, a unit in the last place, of thisBigDecimal.static BigDecimalBigDecimal.valueOf(double val) Translates adoubleinto aBigDecimal, using thedouble's canonical string representation provided by theDouble.toString(double)method.static BigDecimalBigDecimal.valueOf(long val) Translates alongvalue into aBigDecimalwith a scale of zero.static BigDecimalBigDecimal.valueOf(long unscaledVal, int scale) Translates alongunscaled value and anintscale into aBigDecimal.Methods in java.math with parameters of type BigDecimalModifier and TypeMethodDescriptionBigDecimal.add(BigDecimal augend) Returns aBigDecimalwhose value is(this + augend), and whose scale ismax(this.scale(), augend.scale()).BigDecimal.add(BigDecimal augend, MathContext mc) Returns aBigDecimalwhose value is(this + augend), with rounding according to the context settings.intBigDecimal.compareTo(BigDecimal val) Compares thisBigDecimalnumerically with the specifiedBigDecimal.BigDecimal.divide(BigDecimal divisor) Returns aBigDecimalwhose 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) anArithmeticExceptionis thrown.BigDecimal.divide(BigDecimal divisor, int roundingMode) Deprecated.The methoddivide(BigDecimal, RoundingMode)should be used in preference to this legacy method.BigDecimal.divide(BigDecimal divisor, int scale, int roundingMode) Deprecated.The methoddivide(BigDecimal, int, RoundingMode)should be used in preference to this legacy method.BigDecimal.divide(BigDecimal divisor, int scale, RoundingMode roundingMode) Returns aBigDecimalwhose value is(this / divisor), and whose scale is as specified.BigDecimal.divide(BigDecimal divisor, MathContext mc) Returns aBigDecimalwhose value is(this / divisor), with rounding according to the context settings.BigDecimal.divide(BigDecimal divisor, RoundingMode roundingMode) Returns aBigDecimalwhose value is(this / divisor), and whose scale isthis.scale().BigDecimal.divideAndRemainder(BigDecimal divisor) Returns a two-elementBigDecimalarray containing the result ofdivideToIntegralValuefollowed by the result ofremainderon the two operands.BigDecimal.divideAndRemainder(BigDecimal divisor, MathContext mc) Returns a two-elementBigDecimalarray containing the result ofdivideToIntegralValuefollowed by the result ofremainderon the two operands calculated with rounding according to the context settings.BigDecimal.divideToIntegralValue(BigDecimal divisor) Returns aBigDecimalwhose value is the integer part of the quotient(this / divisor)rounded down.BigDecimal.divideToIntegralValue(BigDecimal divisor, MathContext mc) Returns aBigDecimalwhose value is the integer part of(this / divisor).BigDecimal.max(BigDecimal val) Returns the maximum of thisBigDecimalandval.BigDecimal.min(BigDecimal val) Returns the minimum of thisBigDecimalandval.BigDecimal.multiply(BigDecimal multiplicand) Returns aBigDecimalwhose value is(this × multiplicand), and whose scale is(this.scale() + multiplicand.scale()).BigDecimal.multiply(BigDecimal multiplicand, MathContext mc) Returns aBigDecimalwhose value is(this × multiplicand), with rounding according to the context settings.BigDecimal.remainder(BigDecimal divisor) Returns aBigDecimalwhose value is(this % divisor).BigDecimal.remainder(BigDecimal divisor, MathContext mc) Returns aBigDecimalwhose value is(this % divisor), with rounding according to the context settings.BigDecimal.subtract(BigDecimal subtrahend) Returns aBigDecimalwhose value is(this - subtrahend), and whose scale ismax(this.scale(), subtrahend.scale()).BigDecimal.subtract(BigDecimal subtrahend, MathContext mc) Returns aBigDecimalwhose value is(this - subtrahend), with rounding according to the context settings. -
Uses of BigDecimal in java.sql
Methods in java.sql that return BigDecimalModifier and TypeMethodDescriptionCallableStatement.getBigDecimal(int parameterIndex) Retrieves the value of the designated JDBCNUMERICparameter as ajava.math.BigDecimalobject with as many digits to the right of the decimal point as the value contains.CallableStatement.getBigDecimal(int parameterIndex, int scale) Deprecated.usegetBigDecimal(int parameterIndex)orgetBigDecimal(String parameterName)CallableStatement.getBigDecimal(String parameterName) Retrieves the value of a JDBCNUMERICparameter as ajava.math.BigDecimalobject with as many digits to the right of the decimal point as the value contains.ResultSet.getBigDecimal(int columnIndex) Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.math.BigDecimalwith full precision.ResultSet.getBigDecimal(int columnIndex, int scale) Deprecated.UsegetBigDecimal(int columnIndex)orgetBigDecimal(String columnLabel)ResultSet.getBigDecimal(String columnLabel) Retrieves the value of the designated column in the current row of thisResultSetobject as ajava.math.BigDecimalwith full precision.ResultSet.getBigDecimal(String columnLabel, int scale) Deprecated.UsegetBigDecimal(int columnIndex)orgetBigDecimal(String columnLabel)SQLInput.readBigDecimal()Reads the next attribute in the stream and returns it as ajava.math.BigDecimalobject in the Java programming language.Methods in java.sql with parameters of type BigDecimalModifier and TypeMethodDescriptionvoidCallableStatement.setBigDecimal(String parameterName, BigDecimal x) Sets the designated parameter to the givenjava.math.BigDecimalvalue.voidPreparedStatement.setBigDecimal(int parameterIndex, BigDecimal x) Sets the designated parameter to the givenjava.math.BigDecimalvalue.voidResultSet.updateBigDecimal(int columnIndex, BigDecimal x) Updates the designated column with ajava.math.BigDecimalvalue.voidResultSet.updateBigDecimal(String columnLabel, BigDecimal x) Updates the designated column with ajava.sql.BigDecimalvalue.voidSQLOutput.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 BigDecimalModifier and TypeMethodDescriptionScanner.nextBigDecimal()Scans the next token of the input as aBigDecimal. -
Uses of BigDecimal in javax.management.openmbean
Fields in javax.management.openmbean with type parameters of type BigDecimalModifier and TypeFieldDescriptionstatic final SimpleType<BigDecimal>SimpleType.BIGDECIMALTheSimpleTypeinstance describing values whose Java class name isjava.math.BigDecimal. -
Uses of BigDecimal in javax.sql
Methods in javax.sql with parameters of type BigDecimalModifier and TypeMethodDescriptionvoidRowSet.setBigDecimal(int parameterIndex, BigDecimal x) Sets the designated parameter in thisRowSetobject's command to the givenjava.math.BigDecimalvalue.voidRowSet.setBigDecimal(String parameterName, BigDecimal x) Sets the designated parameter to the givenjava.math.BigDecimalvalue. -
Uses of BigDecimal in javax.sql.rowset
Methods in javax.sql.rowset with parameters of type BigDecimalModifier and TypeMethodDescriptionvoidBaseRowSet.setBigDecimal(int parameterIndex, BigDecimal x) Sets the designated parameter to the givenjava.lang.BigDecimalvalue.voidBaseRowSet.setBigDecimal(String parameterName, BigDecimal x) Sets the designated parameter to the givenjava.math.BigDecimalvalue. -
Uses of BigDecimal in javax.sql.rowset.serial
Methods in javax.sql.rowset.serial that return BigDecimalModifier and TypeMethodDescriptionSQLInputImpl.readBigDecimal()Retrieves the next attribute in thisSQLInputImplobject as ajava.math.BigDecimal.Methods in javax.sql.rowset.serial with parameters of type BigDecimalModifier and TypeMethodDescriptionvoidSQLOutputImpl.writeBigDecimal(BigDecimal x) Writes ajava.math.BigDecimalobject in the Java programming language to thisSQLOutputImplobject. -
Uses of BigDecimal in javax.xml.datatype
Methods in javax.xml.datatype that return BigDecimalModifier and TypeMethodDescriptionabstract BigDecimalXMLGregorianCalendar.getFractionalSecond()Returns fractional seconds.Methods in javax.xml.datatype with parameters of type BigDecimalModifier and TypeMethodDescriptionabstract DurationDuration.multiply(BigDecimal factor) Computes a new duration whose value isfactortimes longer than the value of this duration.abstract DurationDatatypeFactory.newDuration(boolean isPositive, BigInteger years, BigInteger months, BigInteger days, BigInteger hours, BigInteger minutes, BigDecimal seconds) Obtain a new instance of aDurationspecifying theDurationas isPositive, years, months, days, hours, minutes, seconds.abstract XMLGregorianCalendarDatatypeFactory.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.DatatypeFactory.newXMLGregorianCalendarTime(int hours, int minutes, int seconds, BigDecimal fractionalSecond, int timezone) Create a Java instance of XML Schema builtin datatype time.abstract voidXMLGregorianCalendar.setFractionalSecond(BigDecimal fractional) Set fractional seconds.voidXMLGregorianCalendar.setTime(int hour, int minute, int second, BigDecimal fractional) Set time as one unit, including the optional infinite precision fractional seconds.
divide(BigDecimal, RoundingMode)should be used in preference to this legacy method.