Class BigDecimal
java.lang.Object
com.codename1.util.BigDecimal
Class representing a simple version of a big decimal. A
BigDecimal is basically a
BigInteger with a few digits on the right of
the decimal point. The number of (binary) digits on the right of the decimal
point is called the scale of the BigDecimal.
Unlike in BigDecimal, the scale is not adjusted
automatically, but must be set manually. All BigDecimals
taking part in the same arithmetic operation must have equal scale. The
result of a multiplication of two BigDecimals returns a
BigDecimal with double scale.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadd(BigDecimal b) add(BigInteger b) adjustScale(int newScale) intcompareTo(BigDecimal val) intcompareTo(BigInteger val) divide(BigDecimal b) divide(BigInteger b) booleanfloor()static BigDecimalgetInstance(BigInteger value, int scale) Returns aBigDecimalwith valuevalue / 2scale / 10scaleintgetScale()inthashCode()intintValue()longnegate()round()shiftLeft(int n) toString()
-
Constructor Details
-
BigDecimal
Constructor for
BigDecimal. The value of the constructedBigDecimalequalsbigInt / 10scale.Parameters
-
bigInt: ThebigIntvalue parameter. -
scale: The scale of the constructedBigDecimal.
-
-
-
Method Details
-
getInstance
Returns a
BigDecimalwith valuevalue / 2scale / 10scaleParameters
-
value: @param value The value of theBigDecimalto be created. -
scale: @param scale The scale of theBigDecimalto be created.
Returns
The such created
BigDecimal.Deprecated
-
-
adjustScale
-
add
-
add
-
negate
-
subtract
-
subtract
-
multiply
-
multiply
-
divide
-
divide
-
shiftLeft
-
compareTo
-
compareTo
-
floor
-
round
-
intValue
public int intValue() -
longValue
public long longValue() -
getScale
public int getScale() -
toString
-
equals
-
hashCode
-