class SimpleBigDecimal
extends java.lang.Object
SimpleBigDecimal
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 SimpleBigDecimal
.
Unlike in BigDecimal
, the scale is not adjusted
automatically, but must be set manually. All SimpleBigDecimal
s
taking part in the same arithmetic operation must have equal scale. The
result of a multiplication of two SimpleBigDecimal
s returns a
SimpleBigDecimal
with double scale.Modifier and Type | Field and Description |
---|---|
private java.math.BigInteger |
bigInt |
private int |
scale |
private static long |
serialVersionUID |
Modifier | Constructor and Description |
---|---|
|
SimpleBigDecimal(java.math.BigInteger bigInt,
int scale)
Constructor for
SimpleBigDecimal . |
private |
SimpleBigDecimal(SimpleBigDecimal limBigDec) |
Modifier and Type | Method and Description |
---|---|
SimpleBigDecimal |
add(java.math.BigInteger b) |
SimpleBigDecimal |
add(SimpleBigDecimal b) |
SimpleBigDecimal |
adjustScale(int newScale) |
private void |
checkScale(SimpleBigDecimal b) |
int |
compareTo(java.math.BigInteger val) |
int |
compareTo(SimpleBigDecimal val) |
SimpleBigDecimal |
divide(java.math.BigInteger b) |
SimpleBigDecimal |
divide(SimpleBigDecimal b) |
boolean |
equals(java.lang.Object o) |
java.math.BigInteger |
floor() |
static SimpleBigDecimal |
getInstance(java.math.BigInteger value,
int scale)
Returns a
SimpleBigDecimal representing the same numerical
value as value . |
int |
getScale() |
int |
hashCode() |
int |
intValue() |
long |
longValue() |
SimpleBigDecimal |
multiply(java.math.BigInteger b) |
SimpleBigDecimal |
multiply(SimpleBigDecimal b) |
SimpleBigDecimal |
negate() |
java.math.BigInteger |
round() |
SimpleBigDecimal |
shiftLeft(int n) |
SimpleBigDecimal |
subtract(java.math.BigInteger b) |
SimpleBigDecimal |
subtract(SimpleBigDecimal b) |
java.lang.String |
toString() |
private static final long serialVersionUID
private final java.math.BigInteger bigInt
private final int scale
public SimpleBigDecimal(java.math.BigInteger bigInt, int scale)
SimpleBigDecimal
. The value of the
constructed SimpleBigDecimal
equals bigInt /
2scale
.bigInt
- The bigInt
value parameter.scale
- The scale of the constructed SimpleBigDecimal
.private SimpleBigDecimal(SimpleBigDecimal limBigDec)
public static SimpleBigDecimal getInstance(java.math.BigInteger value, int scale)
SimpleBigDecimal
representing the same numerical
value as value
.value
- The value of the SimpleBigDecimal
to be
created.scale
- The scale of the SimpleBigDecimal
to be
created.SimpleBigDecimal
.private void checkScale(SimpleBigDecimal b)
public SimpleBigDecimal adjustScale(int newScale)
public SimpleBigDecimal add(SimpleBigDecimal b)
public SimpleBigDecimal add(java.math.BigInteger b)
public SimpleBigDecimal negate()
public SimpleBigDecimal subtract(SimpleBigDecimal b)
public SimpleBigDecimal subtract(java.math.BigInteger b)
public SimpleBigDecimal multiply(SimpleBigDecimal b)
public SimpleBigDecimal multiply(java.math.BigInteger b)
public SimpleBigDecimal divide(SimpleBigDecimal b)
public SimpleBigDecimal divide(java.math.BigInteger b)
public SimpleBigDecimal shiftLeft(int n)
public int compareTo(SimpleBigDecimal val)
public int compareTo(java.math.BigInteger val)
public java.math.BigInteger floor()
public java.math.BigInteger round()
public int intValue()
public long longValue()
public int getScale()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object