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 Java™ programming language.java.util 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.javafx.util.converter This package is for standard string converters for JavaFX.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 Java™ programming language.javax.sql.rowset Standard interfaces and base classes for JDBCRowSet
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 Defines XML/Java Type Mappings.org.omg.CORBA Provides the mapping of the OMG CORBA APIs to the Java™ programming language, including the classORB
, 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 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 Description BigDecimal
BigDecimal. abs()
Returns aBigDecimal
whose value is the absolute value of thisBigDecimal
, and whose scale isthis.scale()
.BigDecimal
BigDecimal. abs(MathContext mc)
Returns aBigDecimal
whose value is the absolute value of thisBigDecimal
, with rounding according to the context settings.BigDecimal
BigDecimal. add(BigDecimal augend)
Returns aBigDecimal
whose value is(this + augend)
, and whose scale ismax(this.scale(), augend.scale())
.BigDecimal
BigDecimal. add(BigDecimal augend, MathContext mc)
Returns aBigDecimal
whose value is(this + augend)
, with rounding according to the context settings.BigDecimal
BigDecimal. divide(BigDecimal divisor)
Returns aBigDecimal
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) anArithmeticException
is thrown.BigDecimal
BigDecimal. divide(BigDecimal divisor, int roundingMode)
Deprecated.The methoddivide(BigDecimal, RoundingMode)
should be used in preference to this legacy method.BigDecimal
BigDecimal. divide(BigDecimal divisor, int scale, int roundingMode)
Deprecated.The methoddivide(BigDecimal, int, RoundingMode)
should be used in preference to this legacy method.BigDecimal
BigDecimal. divide(BigDecimal divisor, int scale, RoundingMode roundingMode)
Returns aBigDecimal
whose value is(this / divisor)
, and whose scale is as specified.BigDecimal
BigDecimal. divide(BigDecimal divisor, MathContext mc)
Returns aBigDecimal
whose value is(this / divisor)
, with rounding according to the context settings.BigDecimal
BigDecimal. divide(BigDecimal divisor, RoundingMode roundingMode)
Returns aBigDecimal
whose value is(this / divisor)
, and whose scale isthis.scale()
.BigDecimal[]
BigDecimal. divideAndRemainder(BigDecimal divisor)
Returns a two-elementBigDecimal
array containing the result ofdivideToIntegralValue
followed by the result ofremainder
on the two operands.BigDecimal[]
BigDecimal. divideAndRemainder(BigDecimal divisor, MathContext mc)
Returns a two-elementBigDecimal
array containing the result ofdivideToIntegralValue
followed by the result ofremainder
on the two operands calculated with rounding according to the context settings.BigDecimal
BigDecimal. divideToIntegralValue(BigDecimal divisor)
Returns aBigDecimal
whose value is the integer part of the quotient(this / divisor)
rounded down.BigDecimal
BigDecimal. divideToIntegralValue(BigDecimal divisor, MathContext mc)
Returns aBigDecimal
whose value is the integer part of(this / divisor)
.BigDecimal
BigDecimal. max(BigDecimal val)
Returns the maximum of thisBigDecimal
andval
.BigDecimal
BigDecimal. min(BigDecimal val)
Returns the minimum of thisBigDecimal
andval
.BigDecimal
BigDecimal. movePointLeft(int n)
Returns aBigDecimal
which is equivalent to this one with the decimal point movedn
places to the left.BigDecimal
BigDecimal. movePointRight(int n)
Returns aBigDecimal
which is equivalent to this one with the decimal point movedn
places to the right.BigDecimal
BigDecimal. multiply(BigDecimal multiplicand)
Returns aBigDecimal
whose value is(this × multiplicand)
, and whose scale is(this.scale() + multiplicand.scale())
.BigDecimal
BigDecimal. multiply(BigDecimal multiplicand, MathContext mc)
Returns aBigDecimal
whose value is(this × multiplicand)
, with rounding according to the context settings.BigDecimal
BigDecimal. negate()
Returns aBigDecimal
whose value is(-this)
, and whose scale isthis.scale()
.BigDecimal
BigDecimal. negate(MathContext mc)
Returns aBigDecimal
whose value is(-this)
, with rounding according to the context settings.BigDecimal
BigDecimal. plus()
Returns aBigDecimal
whose value is(+this)
, and whose scale isthis.scale()
.BigDecimal
BigDecimal. plus(MathContext mc)
Returns aBigDecimal
whose value is(+this)
, with rounding according to the context settings.BigDecimal
BigDecimal. pow(int n)
Returns aBigDecimal
whose value is(thisn)
, The power is computed exactly, to unlimited precision.BigDecimal
BigDecimal. pow(int n, MathContext mc)
Returns aBigDecimal
whose value is(thisn)
.BigDecimal
BigDecimal. remainder(BigDecimal divisor)
Returns aBigDecimal
whose value is(this % divisor)
.BigDecimal
BigDecimal. remainder(BigDecimal divisor, MathContext mc)
Returns aBigDecimal
whose value is(this % divisor)
, with rounding according to the context settings.BigDecimal
BigDecimal. round(MathContext mc)
Returns aBigDecimal
rounded according to theMathContext
settings.BigDecimal
BigDecimal. scaleByPowerOfTen(int n)
Returns a BigDecimal whose numerical value is equal to (this
* 10n).BigDecimal
BigDecimal. setScale(int newScale)
Returns aBigDecimal
whose scale is the specified value, and whose value is numerically equal to thisBigDecimal
's.BigDecimal
BigDecimal. setScale(int newScale, int roundingMode)
Deprecated.The methodsetScale(int, RoundingMode)
should be used in preference to this legacy method.BigDecimal
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.BigDecimal
BigDecimal. sqrt(MathContext mc)
Returns an approximation to the square root ofthis
with rounding according to the context settings.BigDecimal
BigDecimal. stripTrailingZeros()
Returns aBigDecimal
which is numerically equal to this one but with any trailing zeros removed from the representation.BigDecimal
BigDecimal. subtract(BigDecimal subtrahend)
Returns aBigDecimal
whose value is(this - subtrahend)
, and whose scale ismax(this.scale(), subtrahend.scale())
.BigDecimal
BigDecimal. subtract(BigDecimal subtrahend, MathContext mc)
Returns aBigDecimal
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 thisBigDecimal
.static BigDecimal
BigDecimal. valueOf(double val)
Translates adouble
into aBigDecimal
, using thedouble
's canonical string representation provided by theDouble.toString(double)
method.static BigDecimal
BigDecimal. valueOf(long val)
Translates along
value into aBigDecimal
with a scale of zero.static BigDecimal
BigDecimal. valueOf(long unscaledVal, int scale)
Translates along
unscaled value and anint
scale into aBigDecimal
.Methods in java.math with parameters of type BigDecimal Modifier and Type Method Description BigDecimal
BigDecimal. add(BigDecimal augend)
Returns aBigDecimal
whose value is(this + augend)
, and whose scale ismax(this.scale(), augend.scale())
.BigDecimal
BigDecimal. add(BigDecimal augend, MathContext mc)
Returns aBigDecimal
whose value is(this + augend)
, with rounding according to the context settings.int
BigDecimal. compareTo(BigDecimal val)
Compares thisBigDecimal
with the specifiedBigDecimal
.BigDecimal
BigDecimal. divide(BigDecimal divisor)
Returns aBigDecimal
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) anArithmeticException
is thrown.BigDecimal
BigDecimal. divide(BigDecimal divisor, int roundingMode)
Deprecated.The methoddivide(BigDecimal, RoundingMode)
should be used in preference to this legacy method.BigDecimal
BigDecimal. divide(BigDecimal divisor, int scale, int roundingMode)
Deprecated.The methoddivide(BigDecimal, int, RoundingMode)
should be used in preference to this legacy method.BigDecimal
BigDecimal. divide(BigDecimal divisor, int scale, RoundingMode roundingMode)
Returns aBigDecimal
whose value is(this / divisor)
, and whose scale is as specified.BigDecimal
BigDecimal. divide(BigDecimal divisor, MathContext mc)
Returns aBigDecimal
whose value is(this / divisor)
, with rounding according to the context settings.BigDecimal
BigDecimal. divide(BigDecimal divisor, RoundingMode roundingMode)
Returns aBigDecimal
whose value is(this / divisor)
, and whose scale isthis.scale()
.BigDecimal[]
BigDecimal. divideAndRemainder(BigDecimal divisor)
Returns a two-elementBigDecimal
array containing the result ofdivideToIntegralValue
followed by the result ofremainder
on the two operands.BigDecimal[]
BigDecimal. divideAndRemainder(BigDecimal divisor, MathContext mc)
Returns a two-elementBigDecimal
array containing the result ofdivideToIntegralValue
followed by the result ofremainder
on the two operands calculated with rounding according to the context settings.BigDecimal
BigDecimal. divideToIntegralValue(BigDecimal divisor)
Returns aBigDecimal
whose value is the integer part of the quotient(this / divisor)
rounded down.BigDecimal
BigDecimal. divideToIntegralValue(BigDecimal divisor, MathContext mc)
Returns aBigDecimal
whose value is the integer part of(this / divisor)
.BigDecimal
BigDecimal. max(BigDecimal val)
Returns the maximum of thisBigDecimal
andval
.BigDecimal
BigDecimal. min(BigDecimal val)
Returns the minimum of thisBigDecimal
andval
.BigDecimal
BigDecimal. multiply(BigDecimal multiplicand)
Returns aBigDecimal
whose value is(this × multiplicand)
, and whose scale is(this.scale() + multiplicand.scale())
.BigDecimal
BigDecimal. multiply(BigDecimal multiplicand, MathContext mc)
Returns aBigDecimal
whose value is(this × multiplicand)
, with rounding according to the context settings.BigDecimal
BigDecimal. remainder(BigDecimal divisor)
Returns aBigDecimal
whose value is(this % divisor)
.BigDecimal
BigDecimal. remainder(BigDecimal divisor, MathContext mc)
Returns aBigDecimal
whose value is(this % divisor)
, with rounding according to the context settings.BigDecimal
BigDecimal. subtract(BigDecimal subtrahend)
Returns aBigDecimal
whose value is(this - subtrahend)
, and whose scale ismax(this.scale(), subtrahend.scale())
.BigDecimal
BigDecimal. subtract(BigDecimal subtrahend, MathContext mc)
Returns aBigDecimal
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 Description BigDecimal
CallableStatement. getBigDecimal(int parameterIndex)
Retrieves the value of the designated JDBCNUMERIC
parameter as ajava.math.BigDecimal
object with as many digits to the right of the decimal point as the value contains.BigDecimal
CallableStatement. getBigDecimal(int parameterIndex, int scale)
Deprecated.usegetBigDecimal(int parameterIndex)
orgetBigDecimal(String parameterName)
BigDecimal
CallableStatement. getBigDecimal(String parameterName)
Retrieves the value of a JDBCNUMERIC
parameter as ajava.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 thisResultSet
object as ajava.math.BigDecimal
with full precision.BigDecimal
ResultSet. getBigDecimal(int columnIndex, int scale)
Deprecated.UsegetBigDecimal(int columnIndex)
orgetBigDecimal(String columnLabel)
BigDecimal
ResultSet. getBigDecimal(String columnLabel)
Retrieves the value of the designated column in the current row of thisResultSet
object as ajava.math.BigDecimal
with full precision.BigDecimal
ResultSet. getBigDecimal(String columnLabel, int scale)
Deprecated.UsegetBigDecimal(int columnIndex)
orgetBigDecimal(String columnLabel)
BigDecimal
SQLInput. readBigDecimal()
Reads the next attribute in the stream and returns it as ajava.math.BigDecimal
object in the Java programming language.Methods in java.sql with parameters of type BigDecimal Modifier and Type Method Description void
CallableStatement. setBigDecimal(String parameterName, BigDecimal x)
Sets the designated parameter to the givenjava.math.BigDecimal
value.void
PreparedStatement. setBigDecimal(int parameterIndex, BigDecimal x)
Sets the designated parameter to the givenjava.math.BigDecimal
value.void
ResultSet. updateBigDecimal(int columnIndex, BigDecimal x)
Updates the designated column with ajava.math.BigDecimal
value.void
ResultSet. updateBigDecimal(String columnLabel, BigDecimal x)
Updates the designated column with ajava.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 Description BigDecimal
Scanner. nextBigDecimal()
Scans the next token of the input as aBigDecimal
. -
Uses of BigDecimal in javafx.util.converter
Methods in javafx.util.converter that return BigDecimal Modifier and Type Method Description BigDecimal
BigDecimalStringConverter. fromString(String value)
Converts the string provided into an object defined by the specific converter.Methods in javafx.util.converter with parameters of type BigDecimal Modifier and Type Method Description String
BigDecimalStringConverter. toString(BigDecimal value)
Converts the object provided into its string form. -
Uses of BigDecimal in javax.management.openmbean
Fields in javax.management.openmbean with type parameters of type BigDecimal Modifier and Type Field Description static SimpleType<BigDecimal>
SimpleType. BIGDECIMAL
TheSimpleType
instance describing values whose Java class name isjava.math.BigDecimal
. -
Uses of BigDecimal in javax.sql
Methods in javax.sql with parameters of type BigDecimal Modifier and Type Method Description void
RowSet. setBigDecimal(int parameterIndex, BigDecimal x)
Sets the designated parameter in thisRowSet
object's command to the givenjava.math.BigDecimal
value.void
RowSet. setBigDecimal(String parameterName, BigDecimal x)
Sets the designated parameter to the givenjava.math.BigDecimal
value. -
Uses of BigDecimal in javax.sql.rowset
Methods in javax.sql.rowset with parameters of type BigDecimal Modifier and Type Method Description void
BaseRowSet. setBigDecimal(int parameterIndex, BigDecimal x)
Sets the designated parameter to the givenjava.lang.BigDecimal
value.void
BaseRowSet. setBigDecimal(String parameterName, BigDecimal x)
Sets the designated parameter to the givenjava.math.BigDecimal
value. -
Uses of BigDecimal in javax.sql.rowset.serial
Methods in javax.sql.rowset.serial that return BigDecimal Modifier and Type Method Description BigDecimal
SQLInputImpl. readBigDecimal()
Retrieves the next attribute in thisSQLInputImpl
object as ajava.math.BigDecimal
.Methods in javax.sql.rowset.serial with parameters of type BigDecimal Modifier and Type Method Description void
SQLOutputImpl. writeBigDecimal(BigDecimal x)
Writes ajava.math.BigDecimal
object in the Java programming language to thisSQLOutputImpl
object. -
Uses of BigDecimal in javax.xml.bind
Methods in javax.xml.bind that return BigDecimal Modifier and Type Method Description static BigDecimal
DatatypeConverter. parseDecimal(String lexicalXSDDecimal)
Converts the string argument into a BigDecimal value.BigDecimal
DatatypeConverterInterface. 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 Description static String
DatatypeConverter. printDecimal(BigDecimal val)
Converts a BigDecimal value into a string.String
DatatypeConverterInterface. 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 Description abstract BigDecimal
XMLGregorianCalendar. getFractionalSecond()
Returns fractional seconds.Methods in javax.xml.datatype with parameters of type BigDecimal Modifier and Type Method Description abstract Duration
Duration. multiply(BigDecimal factor)
Computes a new duration whose value isfactor
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 aDuration
specifying theDuration
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 Description BigDecimal
FixedHolder. value
The value held by the FixedHolderMethods in org.omg.CORBA that return BigDecimal Modifier and Type Method Description BigDecimal
Any. extract_fixed()
Extracts thejava.math.BigDecimal
object in thisAny
object'svalue
field.Methods in org.omg.CORBA with parameters of type BigDecimal Modifier and Type Method Description void
Any. insert_fixed(BigDecimal value)
Throws anorg.omg.CORBA.NO_IMPLEMENT
exception.void
Any. insert_fixed(BigDecimal value, TypeCode type)
Throws anorg.omg.CORBA.NO_IMPLEMENT
exception.Constructors in org.omg.CORBA with parameters of type BigDecimal Constructor 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 Description BigDecimal
InputStream. read_fixed()
Reads a BigDecimal number.Methods in org.omg.CORBA.portable with parameters of type BigDecimal Modifier and Type Method Description void
OutputStream. write_fixed(BigDecimal value)
Writes a BigDecimal number.
-