public class BigInteger extends Number implements Comparable, ByteEncodable
| Modifier and Type | Field and Description |
|---|---|
static BigInteger |
ONE |
static BigInteger |
ZERO |
| Constructor and Description |
|---|
BigInteger(byte[] val) |
BigInteger(byte[] val,
int offset,
int numBytes) |
BigInteger(int value) |
BigInteger(int signum,
byte[] magnitude) |
BigInteger(int bitLength,
int certainty,
Random rnd) |
BigInteger(int numBits,
Random rnd) |
BigInteger(String val) |
BigInteger(String val,
int radix) |
| Modifier and Type | Method and Description |
|---|---|
BigInteger |
abs() |
BigInteger |
add(BigInteger val) |
BigInteger |
and(BigInteger y)
Return the logical (bit-wise) "and" of two BigIntegers.
|
BigInteger |
andNot(BigInteger val) |
int |
bitCount()
Count one bits in a BigInteger.
|
int |
bitLength()
Calculates ceiling(log2(this < 0 ?
|
BigInteger |
clearBit(int n) |
int |
compareTo(BigInteger val) |
int |
compareTo(Object obj)
Compare this object with another.
|
BigInteger |
divide(BigInteger val) |
BigInteger[] |
divideAndRemainder(BigInteger val) |
double |
doubleValue()
Return the value of this
Number as a float. |
byte[] |
encodeBytes() |
int |
encodeBytes(ByteArray dest)
This requests the Object to encode itself as a stream of bytes which is appended
to the destination ByteArray.
|
boolean |
equals(Object obj)
Returns if this object is considered equal to the other object.
|
BigInteger |
flipBit(int n) |
float |
floatValue()
Return the value of this
Number as a float. |
BigInteger |
gcd(BigInteger y) |
int |
getLowestSetBit() |
int |
hashCode()
Returns a hashCode for the object.
|
int |
intValue()
Return the value of this
Number as an int. |
boolean |
isProbablePrime(int certainty)
Returns
true if this BigInteger is probably prime,
false if it's definitely composite. |
long |
longValue()
Return the value of this
Number as a long. |
BigInteger |
max(BigInteger val) |
BigInteger |
min(BigInteger val) |
BigInteger |
mod(BigInteger m) |
BigInteger |
modInverse(BigInteger y) |
BigInteger |
modPow(BigInteger exponent,
BigInteger m) |
BigInteger |
multiply(BigInteger y) |
BigInteger |
negate() |
BigInteger |
not()
Return the logical (bit-wise) negation of a BigInteger.
|
BigInteger |
or(BigInteger y)
Return the logical (bit-wise) "(inclusive) or" of two BigIntegers.
|
BigInteger |
pow(int exponent)
Calculate the integral power of a BigInteger.
|
static BigInteger |
probablePrime(int bitLength,
Random rnd)
Return a BigInteger that is bitLength bits long with a
probability < 2^-100 of being composite.
|
BigInteger |
remainder(BigInteger val) |
BigInteger |
setBit(int n) |
BigInteger |
shiftLeft(int n) |
BigInteger |
shiftRight(int n) |
int |
signum() |
BigInteger |
subtract(BigInteger val) |
boolean |
testBit(int n) |
byte[] |
toByteArray() |
String |
toString()
Return a String representation of this object.
|
CharArray |
toString(CharArray dest,
int radix) |
String |
toString(int radix) |
static BigInteger |
valueOf(long val)
Return a (possibly-shared) BigInteger with a given long value.
|
int |
write(byte[] bytes,
int offset)
Write the BigInteger as a series of bytes, or find out how many bytes are needed
for storing the BigInteger.
|
BigInteger |
xor(BigInteger y)
Return the logical (bit-wise) "exclusive or" of two BigIntegers.
|
byteValue, shortValuepublic static final BigInteger ZERO
public static final BigInteger ONE
public BigInteger(int value)
public BigInteger(String val, int radix)
public BigInteger(String val)
public BigInteger(byte[] val)
public BigInteger(byte[] val,
int offset,
int numBytes)
public BigInteger(int signum,
byte[] magnitude)
public BigInteger(int numBits,
Random rnd)
public BigInteger(int bitLength,
int certainty,
Random rnd)
public static BigInteger probablePrime(int bitLength, Random rnd)
bitLength - length in bits of resulting numberrnd - random number generator to useArithmeticException - if bitLength < 2public static BigInteger valueOf(long val)
public int signum()
public int compareTo(Object obj)
ComparablecompareTo in interface Comparablepublic int compareTo(BigInteger val)
public BigInteger min(BigInteger val)
public BigInteger max(BigInteger val)
public BigInteger add(BigInteger val)
public BigInteger subtract(BigInteger val)
public BigInteger multiply(BigInteger y)
public BigInteger divide(BigInteger val)
public BigInteger remainder(BigInteger val)
public BigInteger[] divideAndRemainder(BigInteger val)
public BigInteger mod(BigInteger m)
public BigInteger pow(int exponent)
exponent - the exponent (must be non-negative)public BigInteger modInverse(BigInteger y)
public BigInteger modPow(BigInteger exponent, BigInteger m)
public BigInteger gcd(BigInteger y)
public boolean isProbablePrime(int certainty)
Returns true if this BigInteger is probably prime,
false if it's definitely composite. If certainty
is <= 0, true is returned.
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.true if this BigInteger is probably prime,
false if it's definitely composite.public BigInteger shiftLeft(int n)
public BigInteger shiftRight(int n)
public String toString()
Objectpublic String toString(int radix)
public int intValue()
NumberNumber as an int.public long longValue()
NumberNumber as a long.public int hashCode()
Objectpublic boolean equals(Object obj)
Objectpublic double doubleValue()
NumberNumber as a float.doubleValue in class Numberpublic float floatValue()
NumberNumber as a float.floatValue in class Numberpublic BigInteger abs()
public BigInteger negate()
public int bitLength()
public byte[] toByteArray()
public int write(byte[] bytes,
int offset)
data - The destination byte array or null to find out how many bytes are needed.offset - The offset in the byte array to write to.public BigInteger and(BigInteger y)
public BigInteger or(BigInteger y)
public BigInteger xor(BigInteger y)
public BigInteger not()
public BigInteger andNot(BigInteger val)
public BigInteger clearBit(int n)
public BigInteger setBit(int n)
public boolean testBit(int n)
public BigInteger flipBit(int n)
public int getLowestSetBit()
public int bitCount()
public int encodeBytes(ByteArray dest)
ByteEncodableencodeBytes in interface ByteEncodabledest - The destination ByteArray, or null to determine the number of bytes needed to encode.public byte[] encodeBytes()
encodeBytes in interface ByteEncodable