|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Number
com.mckoi.util.BigNumber
public final class BigNumber
Extends BigDecimal to allow a number to be positive infinity, negative infinity and not-a-number. This provides compatibility with float and double types.
Field Summary | |
---|---|
static BigNumber |
BIG_NUMBER_ONE
|
static BigNumber |
BIG_NUMBER_ZERO
Statics for 0 and 1. |
static BigNumber |
NaN
|
static BigNumber |
NEGATIVE_INFINITY
Statics for negative infinity, positive infinity and NaN. |
static BigNumber |
POSITIVE_INFINITY
|
Method Summary | |
---|---|
BigNumber |
abs()
|
BigNumber |
add(BigNumber number)
|
java.math.BigDecimal |
asBigDecimal()
Returns the big number as a BigDecimal object. |
BigNumber |
bitWiseOr(BigNumber number)
|
byte |
byteValue()
Returns this big number as a byte. |
boolean |
canBeRepresentedAsInt()
Returns true if this BigNumber can be represented by a 32-bit int (has no scale). |
boolean |
canBeRepresentedAsLong()
Returns true if this BigNumber can be represented by a 64-bit long (has no scale). |
int |
compareTo(BigNumber number)
Compares this BigNumber with the given BigNumber. |
BigNumber |
divide(BigNumber number)
|
double |
doubleValue()
Returns this big number as a double. |
boolean |
equals(java.lang.Object ob)
The equals comparison uses the BigDecimal 'equals' method to compare values. |
float |
floatValue()
Returns this big number as a float. |
static BigNumber |
fromBigDecimal(java.math.BigDecimal val)
Creates a BigNumber from a BigDecimal. |
static BigNumber |
fromData(byte[] buf,
int scale,
byte state)
Creates a BigNumber from the given data. |
static BigNumber |
fromDouble(double value)
Creates a BigNumber from a double. |
static BigNumber |
fromFloat(float value)
Creates a BigNumber from a float. |
static BigNumber |
fromInt(int value)
Creates a BigNumber from an int. |
static BigNumber |
fromLong(long value)
Creates a BigNumber from a long. |
static BigNumber |
fromString(java.lang.String str)
Creates a BigNumber from a string. |
int |
getScale()
Returns the scale of this number, or -1 if the number has no scale (if it -inf, +inf or NaN). |
byte |
getState()
Returns the state of this number. |
int |
intValue()
Returns this big number as an int. |
long |
longValue()
Returns this big number as a long. |
BigNumber |
multiply(BigNumber number)
|
BigNumber |
setScale(int d,
int round_enum)
|
short |
shortValue()
Returns this big number as a short. |
int |
signum()
|
BigNumber |
sqrt()
|
BigNumber |
subtract(BigNumber number)
|
byte[] |
toByteArray()
Returns this number as a byte array (unscaled). |
java.lang.String |
toString()
Returns this big number as a string. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final BigNumber NEGATIVE_INFINITY
public static final BigNumber POSITIVE_INFINITY
public static final BigNumber NaN
public static final BigNumber BIG_NUMBER_ZERO
public static final BigNumber BIG_NUMBER_ONE
Method Detail |
---|
public boolean canBeRepresentedAsLong()
public boolean canBeRepresentedAsInt()
public int getScale()
public byte getState()
public byte[] toByteArray()
public java.lang.String toString()
toString
in class java.lang.Object
public double doubleValue()
doubleValue
in class java.lang.Number
public float floatValue()
floatValue
in class java.lang.Number
public long longValue()
longValue
in class java.lang.Number
public int intValue()
intValue
in class java.lang.Number
public short shortValue()
shortValue
in class java.lang.Number
public byte byteValue()
byteValue
in class java.lang.Number
public java.math.BigDecimal asBigDecimal()
public int compareTo(BigNumber number)
public boolean equals(java.lang.Object ob)
equals
in class java.lang.Object
public BigNumber bitWiseOr(BigNumber number)
public BigNumber add(BigNumber number)
public BigNumber subtract(BigNumber number)
public BigNumber multiply(BigNumber number)
public BigNumber divide(BigNumber number)
public BigNumber abs()
public int signum()
public BigNumber setScale(int d, int round_enum)
public BigNumber sqrt()
public static BigNumber fromDouble(double value)
public static BigNumber fromFloat(float value)
public static BigNumber fromLong(long value)
public static BigNumber fromInt(int value)
public static BigNumber fromString(java.lang.String str)
public static BigNumber fromBigDecimal(java.math.BigDecimal val)
public static BigNumber fromData(byte[] buf, int scale, byte state)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |