|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Number | +--java.math.BigInteger
Safe:
Field Summary | |
private int |
bitCount
The bitCount of this BigInteger, as returned by bitCount(), or -1 (either value is acceptable). |
private int |
bitLength
The bitLength of this BigInteger, as returned by bitLength(), or -1 (either value is acceptable). |
private static long[] |
bitsPerDigit
|
(package private) static int[] |
bnExpModThreshTable
|
private static int[] |
digitsPerInt
|
private static int[] |
digitsPerLong
|
private int |
firstNonzeroByteNum
The index of the lowest-order byte in the magnitude of this BigInteger that contains a nonzero byte, or -2 (either value is acceptable). |
private int |
firstNonzeroIntNum
The index of the lowest-order int in the magnitude of this BigInteger that contains a nonzero int, or -2 (either value is acceptable). |
private static int[] |
intRadix
|
private static long |
LONG_MASK
This mask is used to obtain the value of an int as if it were unsigned. |
private static BigInteger[] |
longRadix
|
private int |
lowestSetBit
The lowest set bit of this BigInteger, as returned by getLowestSetBit(), or -2 (either value is acceptable). |
(package private) int[] |
mag
The magnitude of this BigInteger, in big-endian order: the zeroth element of this array is the most-significant int of the magnitude. |
private static int |
MAX_CONSTANT
Initialize static constant array when class is loaded. |
private static BigInteger[] |
negConst
|
static BigInteger |
ONE
Enabled: The BigInteger constant one. |
private static BigInteger[] |
posConst
|
private static ObjectStreamField[] |
serialPersistentFields
Serializable fields for BigInteger. |
private static long |
serialVersionUID
use serialVersionUID from JDK 1.1. |
(package private) int |
signum
The signum of this BigInteger: -1 for negative, 0 for zero, or 1 for positive. |
private static BigInteger |
SMALL_PRIME_PRODUCT
|
private static int |
SMALL_PRIME_THRESHOLD
|
(package private) static byte[] |
trailingZeroTable
|
private static BigInteger |
TWO
The BigInteger constant two. |
static BigInteger |
ZERO
Enabled: The BigInteger constant zero. |
private static String[] |
zeros
|
Constructor Summary | |
|
BigInteger(byte[] val)
Enabled: Translates a byte array containing the two's-complement binary representation of a BigInteger into a BigInteger. |
private |
BigInteger(byte[] magnitude,
int signum)
This private constructor is for internal use and assumes that its arguments are correct. |
(package private) |
BigInteger(char[] val)
|
private |
BigInteger(int[] val)
This private constructor translates an int array containing the two's-complement binary representation of a BigInteger into a BigInteger. |
private |
BigInteger(int[] magnitude,
int signum)
This private constructor differs from its public cousin with the arguments reversed in two ways: it assumes that its arguments are correct, and it doesn't copy the magnitude array. |
|
BigInteger(int signum,
byte[] magnitude)
Enabled: Translates the sign-magnitude representation of a BigInteger into a BigInteger. |
private |
BigInteger(int signum,
int[] magnitude)
A constructor for internal use that translates the sign-magnitude representation of a BigInteger into a BigInteger. |
|
BigInteger(int bitLength,
int certainty,
Random rnd)
Enabled: Constructs a randomly generated positive BigInteger that is probably prime, with the specified bitLength. |
|
BigInteger(int numBits,
Random rnd)
Enabled: Constructs a randomly generated BigInteger, uniformly distributed over the range 0 to (2numBits - 1), inclusive. |
private |
BigInteger(long val)
Constructs a BigInteger with the specified value, which may not be zero. |
(package private) |
BigInteger(MutableBigInteger val,
int sign)
This private constructor is for internal use in converting from a MutableBigInteger object into a BigInteger. |
|
BigInteger(String val)
Enabled: Translates the decimal String representation of a BigInteger into a BigInteger. |
|
BigInteger(String val,
int radix)
Enabled: Translates the String representation of a BigInteger in the specified radix into a BigInteger. |
Method Summary | |
boolean |
aboveZero()
Added: Used in the expansion of E's ">" operator |
BigInteger |
abs()
Enabled: Returns a BigInteger whose value is the absolute value of this BigInteger. |
BigInteger |
add(BigInteger val)
Enabled: Returns a BigInteger whose value is (this + val). |
private static int[] |
add(int[] x,
int[] y)
Adds the contents of the int arrays x and y. |
(package private) static int |
addOne(int[] a,
int offset,
int mlen,
int carry)
Add one word to the number a mlen words into a. |
BigInteger |
and(BigInteger val)
Enabled: Returns a BigInteger whose value is (this & val). |
BigInteger |
andNot(BigInteger val)
Suppressed: Returns a BigInteger whose value is (this & ~val). |
double |
approxDivide(double arg)
Added: Always gives back a Double This corresponds to the Java floating-point "/" operator and the E "/" operator. |
char |
asChar()
Added: Returns the Unicode character with this character code. |
double |
asFloat64()
Added: Returns the "best" IEEE double precision floating point equivalent to this number. |
boolean |
atLeastZero()
Added: Used in the expansion of E's ">=" operator |
boolean |
atMostZero()
Added: Used in the expansion of E's "<=" operator |
boolean |
belowZero()
Added: Used in the expansion of E's "<" operator |
(package private) static int |
bitCnt(int val)
|
int |
bitCount()
Enabled: Returns the number of bits in the two's complement representation of this BigInteger that differ from its sign bit. |
(package private) static int |
bitLen(int w)
bitLen(val) is the number of bits in val. |
int |
bitLength()
Enabled: Returns the number of bits in the minimal two's-complement representation of this BigInteger, excluding a sign bit. |
private static int |
bitLength(int[] val,
int len)
Calculate bitlength of contents of the first len elements an int array, assuming there are no leading zero ints. |
BigInteger |
butNot(BigInteger arg)
Added: In E, andNot() is called butNot() |
BigInteger |
ceil()
Added: Defined both here and in DoubleSugar, so you can use this to get a ceil'ed integer no matter what kind of number you start with. |
BigInteger |
clearBit(int n)
Enabled: Returns a BigInteger whose value is equivalent to this BigInteger with the designated bit cleared. |
int |
compareTo(BigInteger val)
Suppressed: Compares this BigInteger with the specified BigInteger. |
int |
compareTo(Object o)
Enabled: Compares this BigInteger with the specified Object. |
int |
compareTo(Object o)
Added: Overrides the inherited 'compareTo' to coerce 'o' to a BigInteger |
BigInteger |
complement()
Deprecated. Use not() instead. |
BigInteger |
cryptoHash()
Added: Actually, a SHA hash |
private static void |
destructiveMulAdd(int[] x,
int y,
int z)
|
BigInteger |
divide(BigInteger val)
Enabled: Returns a BigInteger whose value is (this / val). |
BigInteger[] |
divideAndRemainder(BigInteger val)
Enabled: Returns an array of two BigIntegers containing (this / val) followed by (this % val). |
double |
doubleValue()
Enabled: Converts this BigInteger to a double . |
boolean |
equals(Object x)
Suppressed: Compares this BigInteger with the specified Object for equality. |
private int |
firstNonzeroIntNum()
Returns the index of the int that contains the first nonzero int in the little-endian binary representation of the magnitude (int 0 is the least significant). |
BigInteger |
flipBit(int n)
Enabled: Returns a BigInteger whose value is equivalent to this BigInteger with the designated bit flipped. |
float |
floatValue()
Enabled: Converts this BigInteger to a float . |
BigInteger |
floor()
Added: Defined both here and in DoubleSugar, so you can use this to get a floor'ed integer no matter what kind of number you start with. |
BigInteger |
floorDivide(BigInteger arg)
Added: Always gives an integer, resulting from rounding towards negative infinity, ie, flooring. |
static BigInteger |
fromString64(String s)
Added: Convert a base 64 string to an integer. |
BigInteger |
gcd(BigInteger val)
Enabled: Returns a BigInteger whose value is the greatest common divisor of abs(this) and abs(val). |
private int |
getInt(int n)
Returns the specified int of the little-endian two's complement representation (int 0 is the least significant). |
int |
getLowestSetBit()
Enabled: Returns the index of the rightmost (lowest-order) one bit in this BigInteger (the number of zero bits to the right of the rightmost one bit). |
int |
hashCode()
Suppressed: Returns the hash code for this BigInteger. |
private static int |
intArrayCmp(int[] arg1,
int[] arg2)
|
private static int |
intArrayCmpToLen(int[] arg1,
int[] arg2,
int len)
|
private int |
intLength()
Returns the length of the two's complement representation in ints, including space for at least one sign bit. |
int |
intValue()
Enabled: Converts this BigInteger to an int . |
boolean |
isNaN()
Added: All integers are numbers, so this is always false |
boolean |
isProbablePrime(int certainty)
Suppressed: Returns true if this BigInteger is probably prime, false if it's definitely composite. |
boolean |
isZero()
Added: Used for arithmetic equality |
(package private) int |
jacobiSymbol(int p,
BigInteger n)
Computes Jacobi(p,n). |
(package private) int[] |
javaIncrement(int[] val)
|
private static BigInteger |
largePrime(int bitLength,
int certainty,
Random rnd)
Find a random number of the specified bitLength that is probably prime. |
private static int[] |
leftShift(int[] a,
int len,
int n)
Left shift int array a up to len by n bits. |
long |
longValue()
Enabled: Converts this BigInteger to a long . |
private static BigInteger |
lucasLehmerSequence(int z,
BigInteger k,
BigInteger n)
|
private byte[] |
magSerializedForm()
Returns the mag array as an array of bytes. |
private static int[] |
makePositive(byte[] a)
Takes an array a representing a negative 2's-complement number and returns the minimal (no leading zero bytes) unsigned whose value is -a. |
private static int[] |
makePositive(int[] a)
Takes an array a representing a negative 2's-complement number and returns the minimal (no leading zero ints) unsigned whose value is -a. |
BigInteger |
max(BigInteger val)
Enabled: Returns the maximum of this BigInteger and val. |
BigInteger |
min(BigInteger val)
Enabled: Returns the minimum of this BigInteger and val. |
BigInteger |
mod(BigInteger m)
Enabled: Returns a BigInteger whose value is (this mod m). |
BigInteger |
mod(BigInteger arg)
Added: Remainder from the floorDivide operation. |
private BigInteger |
mod2(int p)
Returns a BigInteger whose value is this mod(2**p). |
BigInteger |
modInverse(BigInteger m)
Enabled: Returns a BigInteger whose value is (this-1 mod m). |
BigInteger |
modPow(BigInteger exponent,
BigInteger m)
Enabled: Returns a BigInteger whose value is (thisexponent mod m). |
private BigInteger |
modPow2(BigInteger exponent,
int p)
Returns a BigInteger whose value is (this ** exponent) mod (2**p) |
private static int[] |
montReduce(int[] n,
int[] mod,
int mlen,
int inv)
Montgomery reduce n, modulo mod. |
(package private) static int |
mulAdd(int[] out,
int[] in,
int offset,
int len,
int k)
Multiply an array by one word k and add to result, return the carry |
BigInteger |
multiply(BigInteger val)
Enabled: Returns a BigInteger whose value is (this * val). |
private int[] |
multiplyToLen(int[] x,
int xlen,
int[] y,
int ylen,
int[] z)
Multiplies int arrays x and y to the specified lengths and places the result into z. |
BigInteger |
negate()
Enabled: Returns a BigInteger whose value is (-this). |
BigInteger |
next()
Added: The next higher integer |
BigInteger |
not()
Enabled: Returns a BigInteger whose value is (~this). |
private BigInteger |
oddModPow(BigInteger y,
BigInteger z)
Returns a BigInteger whose value is x to the power of y mod z. |
BigInteger |
or(BigInteger val)
Enabled: Returns a BigInteger whose value is (this | val). |
private int |
parseInt(char[] source,
int start,
int end)
|
private boolean |
passesLucasLehmer()
Returns true iff this BigInteger is a Lucas-Lehmer probable prime. |
private boolean |
passesMillerRabin(int iterations)
Returns true iff this BigInteger passes the specified number of Miller-Rabin tests. |
BigInteger |
pow(int exponent)
Enabled: Returns a BigInteger whose value is (thisexponent). |
BigInteger |
previous()
Added: The next lower integer |
(package private) boolean |
primeToCertainty(int certainty)
Returns true if this BigInteger is probably prime, false if it's definitely composite. |
(package private) static void |
primitiveLeftShift(int[] a,
int len,
int n)
|
(package private) static void |
primitiveRightShift(int[] a,
int len,
int n)
|
static BigInteger |
probablePrime(int bitLength,
Random rnd)
Suppressed: Returns a positive BigInteger that is probably prime, with the specified bitLength. |
private static byte[] |
randomBits(int numBits,
Random rnd)
|
private void |
readObject(ObjectInputStream s)
Reconstitute the BigInteger instance from a stream (that is, deserialize it). |
BigInteger |
remainder(BigInteger val)
Enabled: Returns a BigInteger whose value is (this % val). |
BigInteger |
round()
Added: Defined both here and in DoubleSugar, so you can use this to get round'ed integer no matter what kind of number you start with. |
BigInteger |
setBit(int n)
Enabled: Returns a BigInteger whose value is equivalent to this BigInteger with the designated bit set. |
BigInteger |
shiftLeft(int n)
Enabled: Returns a BigInteger whose value is (this << n). |
BigInteger |
shiftRight(int n)
Enabled: Returns a BigInteger whose value is (this >> n). |
private int |
signBit()
|
private int |
signInt()
|
int |
signum()
Enabled: Returns the signum function of this BigInteger. |
private static BigInteger |
smallPrime(int bitLength,
int certainty,
Random rnd)
Find a random number of the specified bitLength that is probably prime. |
private BigInteger |
square()
Returns a BigInteger whose value is (this2). |
private static int[] |
squareToLen(int[] x,
int len,
int[] z)
Squares the contents of the int array x. |
private static int[] |
stripLeadingZeroBytes(byte[] a)
Returns a copy of the input array stripped of any leading zero bytes. |
private static int[] |
stripLeadingZeroInts(int[] val)
Returns a copy of the input array stripped of any leading zero bytes. |
private static int |
subN(int[] a,
int[] b,
int len)
Subtracts two numbers of same length, returning borrow. |
BigInteger |
subtract(BigInteger val)
Enabled: Returns a BigInteger whose value is (this - val). |
private static int[] |
subtract(int[] big,
int[] little)
Subtracts the contents of the second int arrays (little) from the first (big). |
boolean |
testBit(int n)
Enabled: Returns true if and only if the designated bit is set. |
byte[] |
toByteArray()
Enabled: Returns a byte array containing the two's-complement representation of this BigInteger. |
String |
toString()
Suppressed: Returns the decimal String representation of this BigInteger. |
String |
toString(int radix)
Enabled: Returns the String representation of this BigInteger in the given radix. |
String |
toString64()
Added: Convert an integer to a base 64 string, with an optional leading minus sign. |
(package private) static int |
trailingZeroCnt(int val)
|
BigInteger |
truncate()
Added: Defined both here and in DoubleSugar, so you can use this to get truncate'd integer no matter what kind of number you start with. |
BigInteger |
truncDivide(BigInteger arg)
Added: Always gives an integer resulting from rounding towards zero, ie, truncating. |
private static int[] |
trustedStripLeadingZeroInts(int[] val)
Returns the input array stripped of any leading zero bytes. |
private static BigInteger |
valueOf(int[] val)
Returns a BigInteger with the given two's complement representation. |
static BigInteger |
valueOf(long val)
Enabled: Returns a BigInteger whose value is equal to that of the specified long . |
private void |
writeObject(ObjectOutputStream s)
Save the BigInteger instance to a stream. |
BigInteger |
xor(BigInteger val)
Enabled: Returns a BigInteger whose value is (this ^ val). |
Methods inherited from class java.lang.Number |
byteValue, shortValue |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
int signum
int[] mag
private int bitCount
bitCount
private int bitLength
bitLength
private int lowestSetBit
getLowestSetBit()
private int firstNonzeroByteNum
private int firstNonzeroIntNum
private static final long LONG_MASK
private static long[] bitsPerDigit
private static final int SMALL_PRIME_THRESHOLD
private static final BigInteger SMALL_PRIME_PRODUCT
private static final int MAX_CONSTANT
private static BigInteger[] posConst
private static BigInteger[] negConst
public static final BigInteger ZERO
public static final BigInteger ONE
private static final BigInteger TWO
static int[] bnExpModThreshTable
static final byte[] trailingZeroTable
private static String[] zeros
private static int[] digitsPerLong
private static BigInteger[] longRadix
private static int[] digitsPerInt
private static int[] intRadix
private static final long serialVersionUID
private static final ObjectStreamField[] serialPersistentFields
Constructor Detail |
public BigInteger(byte[] val)
val
- big-endian two's-complement binary representation of
BigInteger.
NumberFormatException
- val is zero bytes long.private BigInteger(int[] val)
public BigInteger(int signum, byte[] magnitude)
signum
- signum of the number (-1 for negative, 0 for zero, 1
for positive).magnitude
- big-endian binary representation of the magnitude of
the number.
NumberFormatException
- signum is not one of the three
legal values (-1, 0, and 1), or signum is 0 and
magnitude contains one or more non-zero bytes.private BigInteger(int signum, int[] magnitude)
public BigInteger(String val, int radix)
val
- String representation of BigInteger.radix
- radix to be used in interpreting val.
NumberFormatException
- val is not a valid representation
of a BigInteger in the specified radix, or radix is
outside the range from Character.MIN_RADIX
to
Character.MAX_RADIX
, inclusive.Character.digit(char, int)
BigInteger(char[] val)
public BigInteger(String val)
val
- decimal String representation of BigInteger.
NumberFormatException
- val is not a valid representation
of a BigInteger.Character.digit(char, int)
public BigInteger(int numBits, Random rnd)
numBits
- maximum bitLength of the new BigInteger.rnd
- source of randomness to be used in computing the new
BigInteger.
IllegalArgumentException
- numBits is negative.bitLength
public BigInteger(int bitLength, int certainty, Random rnd)
It is recommended that the probablePrime
method be used in preference to this constructor unless there
is a compelling need to specify a certainty.
bitLength
- bitLength of the returned BigInteger.certainty
- a measure of the uncertainty that the caller is
willing to tolerate. The probability that the new BigInteger
represents a prime number will exceed
(1 - 1/2certainty). The execution time of
this constructor is proportional to the value of this parameter.rnd
- source of random bits used to select candidates to be
tested for primality.
ArithmeticException
- bitLength < 2.bitLength
private BigInteger(int[] magnitude, int signum)
private BigInteger(byte[] magnitude, int signum)
BigInteger(MutableBigInteger val, int sign)
private BigInteger(long val)
Method Detail |
private int parseInt(char[] source, int start, int end)
private static void destructiveMulAdd(int[] x, int y, int z)
private static byte[] randomBits(int numBits, Random rnd)
public static BigInteger probablePrime(int bitLength, Random rnd)
bitLength
- bitLength of the returned BigInteger.rnd
- source of random bits used to select candidates to be
tested for primality.
ArithmeticException
- bitLength < 2.bitLength
private static BigInteger smallPrime(int bitLength, int certainty, Random rnd)
private static BigInteger largePrime(int bitLength, int certainty, Random rnd)
boolean primeToCertainty(int certainty)
certainty
- a measure of the uncertainty that the caller is
willing to tolerate: if the call returns true
the probability that this BigInteger is prime exceeds
(1 - 1/2certainty). The execution time of
this method is proportional to the value of this parameter.
private boolean passesLucasLehmer()
int jacobiSymbol(int p, BigInteger n)
private static BigInteger lucasLehmerSequence(int z, BigInteger k, BigInteger n)
private boolean passesMillerRabin(int iterations)
public static BigInteger valueOf(long val)
long
. This "static factory method" is
provided in preference to a (long
) constructor
because it allows for reuse of frequently used BigIntegers.
val
- value of the BigInteger to return.
private static BigInteger valueOf(int[] val)
public BigInteger add(BigInteger val)
val
- value to be added to this BigInteger.
private static int[] add(int[] x, int[] y)
public BigInteger subtract(BigInteger val)
val
- value to be subtracted from this BigInteger.
private static int[] subtract(int[] big, int[] little)
public BigInteger multiply(BigInteger val)
val
- value to be multiplied by this BigInteger.
private int[] multiplyToLen(int[] x, int xlen, int[] y, int ylen, int[] z)
private BigInteger square()
private static final int[] squareToLen(int[] x, int len, int[] z)
public BigInteger divide(BigInteger val)
val
- value by which this BigInteger is to be divided.
ArithmeticException
- val==0public BigInteger[] divideAndRemainder(BigInteger val)
val
- value by which this BigInteger is to be divided, and the
remainder computed.
ArithmeticException
- val==0public BigInteger remainder(BigInteger val)
val
- value by which this BigInteger is to be divided, and the
remainder computed.
ArithmeticException
- val==0public BigInteger pow(int exponent)
exponent
- exponent to which this BigInteger is to be raised.
ArithmeticException
- exponent is negative. (This would
cause the operation to yield a non-integer value.)public BigInteger gcd(BigInteger val)
val
- value with with the GCD is to be computed.
private static int[] leftShift(int[] a, int len, int n)
static void primitiveRightShift(int[] a, int len, int n)
static void primitiveLeftShift(int[] a, int len, int n)
private static int bitLength(int[] val, int len)
public BigInteger abs()
public BigInteger negate()
public int signum()
public BigInteger mod(BigInteger m)
m
- the modulus.
ArithmeticException
- m <= 0remainder(java.math.BigInteger)
public BigInteger modPow(BigInteger exponent, BigInteger m)
exponent
- the exponent.m
- the modulus.
ArithmeticException
- m <= 0modInverse(java.math.BigInteger)
private BigInteger oddModPow(BigInteger y, BigInteger z)
private static int[] montReduce(int[] n, int[] mod, int mlen, int inv)
private static int intArrayCmpToLen(int[] arg1, int[] arg2, int len)
private static int subN(int[] a, int[] b, int len)
static int mulAdd(int[] out, int[] in, int offset, int len, int k)
static int addOne(int[] a, int offset, int mlen, int carry)
private BigInteger modPow2(BigInteger exponent, int p)
private BigInteger mod2(int p)
public BigInteger modInverse(BigInteger m)
m
- the modulus.
ArithmeticException
- m <= 0, or this BigInteger
has no multiplicative inverse mod m (that is, this BigInteger
is not relatively prime to m).public BigInteger shiftLeft(int n)
n
- shift distance, in bits.
shiftRight(int)
public BigInteger shiftRight(int n)
n
- shift distance, in bits.
shiftLeft(int)
int[] javaIncrement(int[] val)
public BigInteger and(BigInteger val)
val
- value to be AND'ed with this BigInteger.
public BigInteger or(BigInteger val)
val
- value to be OR'ed with this BigInteger.
public BigInteger xor(BigInteger val)
val
- value to be XOR'ed with this BigInteger.
public BigInteger not()
public BigInteger andNot(BigInteger val)
val
- value to be complemented and AND'ed with this BigInteger.
public boolean testBit(int n)
n
- index of bit to test.
ArithmeticException
- n is negative.public BigInteger setBit(int n)
n
- index of bit to set.
ArithmeticException
- n is negative.public BigInteger clearBit(int n)
n
- index of bit to clear.
ArithmeticException
- n is negative.public BigInteger flipBit(int n)
n
- index of bit to flip.
ArithmeticException
- n is negative.public int getLowestSetBit()
public int bitLength()
static int bitLen(int w)
public int bitCount()
static int bitCnt(int val)
static int trailingZeroCnt(int val)
public boolean isProbablePrime(int certainty)
certainty
- a measure of the uncertainty that the caller is
willing to tolerate: if the call returns true
the probability that this BigInteger is prime exceeds
(1 - 1/2certainty). The execution time of
this method is proportional to the value of this parameter.
public int compareTo(BigInteger val)
val
- BigInteger to which this BigInteger is to be compared.
public int compareTo(Object o)
compareTo
in interface Comparable
o
- Object to which this BigInteger is to be compared.
ClassCastException
- o is not a BigInteger.compareTo(java.math.BigInteger)
,
Comparable
private static int intArrayCmp(int[] arg1, int[] arg2)
public boolean equals(Object x)
equals
in class Object
x
- Object to which this BigInteger is to be compared.
Object.hashCode()
,
java.util.Hashtable
public BigInteger min(BigInteger val)
val
- value with with the minimum is to be computed.
public BigInteger max(BigInteger val)
val
- value with with the maximum is to be computed.
public int hashCode()
hashCode
in class Object
java.lang.Object#equals(java.lang.Object)
,
java.util.Hashtable
public String toString(int radix)
Character.MIN_RADIX
to Character.MAX_RADIX
inclusive,
it will default to 10 (as is the case for
Integer.toString). The digit-to-character mapping
provided by Character.forDigit is used, and a minus
sign is prepended if appropriate. (This representation is
compatible with the (String,
int
)
constructor.)
radix
- radix of the String representation.
Integer.toString(int, int)
,
Character.forDigit(int, int)
,
BigInteger(java.lang.String, int)
public String toString()
(String)
constructor, and
allows for String concatenation with Java's + operator.)
toString
in class Object
Character.forDigit(int, int)
,
BigInteger(java.lang.String)
public byte[] toByteArray()
(byte[])
constructor.)
BigInteger(byte[])
public int intValue()
int
. This
conversion is analogous to a narrowing
primitive conversion from long
to
int
as defined in the Java Language
Specification: if this BigInteger is too big to fit in an
int
, only the low-order 32 bits are returned.
Note that this conversion can lose information about the
overall magnitude of the BigInteger value as well as return a
result with the opposite sign.
intValue
in class Number
int
.public long longValue()
long
. This
conversion is analogous to a narrowing
primitive conversion from long
to
int
as defined in the Java Language
Specification: if this BigInteger is too big to fit in a
long
, only the low-order 64 bits are returned.
Note that this conversion can lose information about the
overall magnitude of the BigInteger value as well as return a
result with the opposite sign.
longValue
in class Number
long
.public float floatValue()
float
. This
conversion is similar to the narrowing
primitive conversion from double
to
float
defined in the Java Language
Specification: if this BigInteger has too great a magnitude
to represent as a float
, it will be converted to
Float.NEGATIVE_INFINITY
or Float.POSITIVE_INFINITY
as appropriate. Note that even when
the return value is finite, this conversion can lose
information about the precision of the BigInteger value.
floatValue
in class Number
float
.public double doubleValue()
double
. This
conversion is similar to the narrowing
primitive conversion from double
to
float
defined in the Java Language
Specification: if this BigInteger has too great a magnitude
to represent as a double
, it will be converted to
Double.NEGATIVE_INFINITY
or Double.POSITIVE_INFINITY
as appropriate. Note that even when
the return value is finite, this conversion can lose
information about the precision of the BigInteger value.
doubleValue
in class Number
double
.private static int[] stripLeadingZeroInts(int[] val)
private static int[] trustedStripLeadingZeroInts(int[] val)
private static int[] stripLeadingZeroBytes(byte[] a)
private static int[] makePositive(byte[] a)
private static int[] makePositive(int[] a)
private int intLength()
private int signBit()
private int signInt()
private int getInt(int n)
private int firstNonzeroIntNum()
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
private void writeObject(ObjectOutputStream s) throws IOException
IOException
private byte[] magSerializedForm()
public int compareTo(Object o)
compareTo
in interface Comparable
o
- the Object to be compared.
public BigInteger next()
public boolean isNaN()
public BigInteger previous()
public BigInteger ceil()
public BigInteger floor()
public BigInteger round()
public BigInteger butNot(BigInteger arg)
public BigInteger mod(BigInteger arg)
(a floorDivide b)*b + (a modulo b) == a [ 5, 3]: ( 1* 3) + 2 == 5 [ 5,-3]: (-2*-3) + -1 == 5 [-5, 3]: (-2* 3) + 1 == -5 [-5,-3]: ( 1*-3) + -2 == -5
Therefore, if the result is non-zero, the sign of the result must be the same as the sign of b, and so the result ranges from 0 inclusive to b exclusive. This corresponds to the E "%%" operator. When b >= 0, it also corresponds to Java's BigInteger.mod().
public double asFloat64()
public boolean isZero()
public char asChar()
public BigInteger truncate()
public double approxDivide(double arg)
public boolean aboveZero()
public boolean atLeastZero()
public boolean atMostZero()
public boolean belowZero()
public BigInteger complement()
not()
instead.
However, the E style, supported by other set-like abstractions, is to use unary "!" instead.
public BigInteger floorDivide(BigInteger arg)
public BigInteger truncDivide(BigInteger arg)
(a truncDivide b)*b + (a remainder b) == a [ 5, 3]: ( 1* 3) + 2 == 5 [ 5,-3]: (-1*-3) + 2 == 5 [-5, 3]: (-1* 3) + -2 == -5 [-5,-3]: ( 1*-3) + -2 == -5
Therefore, if the result is non-zero, the sign of the result must be the same as the sign of a. This corresponds to the Java and E "%" operator.
public String toString64()
A negative integer is encoded as a "-" followed by the encoding of the absolute magnitude. For a positive integer, the encoded length will be (4 * b.length)/3, rounded up to the next integral (non-fractional) character length.
Each base 64 digit is encoded by one of the characters
public BigInteger cryptoHash()
public static BigInteger fromString64(String s) throws NumberFormatException
s
- The string in base 64 notation, with an optional leading
'-', in the format produced by
BigIntegerSugar#toString64(BigInteger)
.
NumberFormatException
- if there is an invalid base 64
character in the input string.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |