Definition of Bigdecimal

JDK Doc(JAVA)
BigDecimal
- class java.math..BigDecimal 
public class BigDecimal extends Number implements Comparable 
Tree:java.lang.Object - java.lang.Number - java.math.BigDecimal
Immutable, arbitrary-precision signed decimal numbers. A BigDecimal consists of an arbitrary precision integer and a non-negative 32-bit integer , which represents the number of digits to the right of the decimal point. The number represented by the BigDecimal is . BigDecimal provides operations for basic arithmetic, scale manipulation, comparison, hashing, and format conversion.

BigDecimal(BigInteger)
- Constructor for class java.math.BigDecimal 
public BigDecimal (BigInteger  val)
Translates a BigInteger into a BigDecimal. The scale of the BigDecimal is zero.Parameters: val - BigInteger value to be converted to BigDecimal.

BigDecimal(BigInteger, int)
- Constructor for class java.math.BigDecimal 
public BigDecimal (BigInteger  unscaledVal, int scale)
Translates a BigInteger unscaled value and an int scale into a BigDecimal. The value of the BigDecimal is (unscaledVal/10).Parameters: unscaledVal - unscaled value of the BigDecimal. - scale of the BigDecimal.scale - scale of the BigDecimal.Throws: NumberFormatException - scale is negative

BigDecimal(String)
- Constructor for class java.math.BigDecimal 
public BigDecimal (String  val)
Translates the String representation of a BigDecmal into a BigDecimal. The String representation consists of an optional minus sign followed by a sequence of zero or more decimal digits, optionally followed by a fraction. The fraction consists of of a decimal point followed by zero or more decimal digits. The string must contain at least one digit in the integer or fractional part. The scale of the resulting BigDecimal will be the number of digits to the right of the decimal point in the string, or 0 if the string contains no decimal point. The character-to-digit mapping is provided by Character.digit. The String may not contain any extraneous characters (whitespace, for example).Parameters: val - String representation of BigDecimal.Throws: NumberFormatException - val is not a valid representation of a BigDecimal.See Also:  Character.digit(char, int)

BigDecimal(double)
- Constructor for class java.math.BigDecimal 
public BigDecimal (double val)
Translates a double into a BigDecimal. The scale of the BigDecimal is the smallest value such that (10 * val) is an integer. Note: the results of this constructor can be somewhat unpredictable. One might assume that is exactly equal to .1, but it is actually equal to .1000000000000000055511151231257827021181583404541015625. This is so because .1 cannot be represented exactly as a double (or, for that matter, as a binary fraction of any finite length). Thus, the long value that is being passed to the constructor is not exactly equal to .1, appearances nonwithstanding. The (String) constructor, on the other hand, is perfectly predictable: is equal to .1, as one would expect. Therefore, it is generally recommended that the (String) constructor be used in preference to this one.Parameters: val - double value to be converted to BigDecimal.Throws: NumberFormatException - val is equal to Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, or Double.NaN.

Search Dictionary:
Search Web Search Dictionary