|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--java.lang.Number
|
+--org.znerd.math.RealNumber
|
+--org.znerd.math.RationalNumber
|
+--org.znerd.math.IntegerNumber
|
+--org.znerd.math.BigIntegerNumber
Basic implementation of an integer number. This implementation is based on
a java.math.BigInteger. It can hold all values from
-2**32 to (2**32 - 1).
Instances must be obtained by using the
createInstance() factory method.
BigInteger, Serialized Form| Fields inherited from class org.znerd.math.RealNumber |
MAXIMUM_RADIX |
| Constructor Summary | |
protected |
BigIntegerNumber(BigInteger n)
Constructs a BigIntegerNumber from a
BigInteger. |
| Method Summary | |
IntegerNumber |
add(IntegerNumber n)
Computes this + n, where n is an integer number. |
static BigIntegerNumber |
createInstance(BigInteger n)
Returns an instance of a BigIntegerNumber based on a
java.math.BigInteger. |
double |
doubleValue()
Returns the value of this number as a double. |
int |
hashCode()
|
IntegerNumber |
integerDivide(IntegerNumber n)
Computes the integer result of this/n, where n is an integer number. |
long |
longValue()
Returns the value of this number as a long. |
IntegerNumber |
multiply(IntegerNumber n)
Computes this * n, where n is an integer number. |
DigitSet |
round(int radix,
int precision,
RoundingMode roundingMode)
Rounds to the specified radix, using the specified precision and rounding mode. |
BigInteger |
toBigInteger()
Converts the value of this number to a BigInteger. |
byte[] |
toByteArray()
Returns the two's-complement representation of this integer number. |
| Methods inherited from class org.znerd.math.IntegerNumber |
abs,
absInteger,
add,
compareTo,
compareToImpl,
compareToImpl,
dec,
divide,
fac,
gcd,
inc,
invert,
isRelativePrime,
multiply,
negate,
negateInteger,
pow,
remainder,
subtract,
subtract,
toBigDecimal,
toBigDecimal,
toBigDecimal,
trunc |
| Methods inherited from class org.znerd.math.RationalNumber |
add,
compareTo,
compareToImpl,
compareToImpl2,
divide,
getDenominator,
getNumerator,
multiply,
pow,
subtract |
| Methods inherited from class org.znerd.math.RealNumber |
byteValue,
compareTo,
compareTo,
equals,
fitsByte,
fitsDouble,
fitsFloat,
fitsInt,
fitsLong,
fitsShort,
floatValue,
getSign,
intValue,
shortValue,
toString |
| Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
| Constructor Detail |
protected BigIntegerNumber(BigInteger n)
throws IllegalArgumentException
BigIntegerNumber from a
BigInteger.n - the value for the new number.| Method Detail |
public static BigIntegerNumber createInstance(BigInteger n)
throws IllegalArgumentException
BigIntegerNumber based on a
java.math.BigInteger.n - the BigInteger to construct a BigIntegerNumber
from.BigIntegerNumber
instance.n == null.public int hashCode()
public DigitSet round(int radix,
int precision,
RoundingMode roundingMode)
throws IllegalArgumentException
radix - the radix, always >= 2 and <= RealNumber.MAXIMUM_RADIX.precision - the precision, always >= 1.roundingMode - the rounding mode, never null.radix < 2
|| radix > RealNumber.MAXIMUM_RADIX
|| precision < 1
|| roundingMode == null.
public IntegerNumber add(IntegerNumber n)
throws IllegalArgumentException
n - the number to add to this, not null.null.null.
public IntegerNumber multiply(IntegerNumber n)
throws IllegalArgumentException
n - the number to multiply this by, not null.null.n == null.
public IntegerNumber integerDivide(IntegerNumber n)
throws ArithmeticException,
IllegalArgumentException
n - the number to divide this by.null.public long longValue()
long. This may
involve rounding.long.public double doubleValue()
double. This may
involve rounding.double.public byte[] toByteArray()
public BigInteger toBigInteger()
BigInteger.BigInteger with the value of this.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||