java.math
Class BigInt
java.lang.Object
java.math.BigInt
class BigInt
- extends Object
In contrast to BigIntegers this class doesn't fake two's complement representation.
Any Bit-Operations, including Shifting, solely regard the unsigned magnitude.
Moreover BigInt objects are mutable and offer efficient in-place-operations.
|
Method Summary |
void |
add(BigInt a)
|
static BigInt |
addition(BigInt a,
BigInt b)
|
void |
addPositiveInt(int w)
|
byte[] |
bigEndianMagnitude()
|
byte[] |
bigEndianTwosComplement()
|
static BigInt |
bigExp(BigInt a,
BigInt p,
BigInt.Context t)
|
int |
bitLength()
|
static int |
cmp(BigInt a,
BigInt b)
|
static int |
consumeErrors(StringBuilder sb)
|
BigInt |
copy()
|
String |
decString()
|
void |
dispose()
|
int |
divideByPositiveInt(int w)
|
static void |
division(BigInt dividend,
BigInt divisor,
BigInt.Context t,
BigInt quotient,
BigInt remainder)
|
static BigInt |
exp(BigInt a,
int p,
BigInt.Context t)
|
protected void |
finalize()
Called by the virtual machine when there are no longer any (non-weak)
references to the receiver. |
static BigInt |
gcd(BigInt a,
BigInt b,
BigInt.Context t)
|
static BigInt |
generatePrimeDefault(int bitLength,
Random rnd,
BigInt.Context t)
|
(package private) static int |
getCtx(BigInt.Context t)
|
int |
getNativeBIGNUM()
|
String |
hexString()
|
boolean |
isBitSet(int n)
|
boolean |
isPrime(int certainty,
Random rnd,
BigInt.Context t)
|
int[] |
littleEndianIntsMagnitude()
|
long |
longInt()
|
static BigInt |
modExp(BigInt a,
BigInt p,
BigInt m,
BigInt.Context t)
|
void |
modifyBit(int n,
int op)
|
static BigInt |
modInverse(BigInt a,
BigInt m,
BigInt.Context t)
|
static BigInt |
modulus(BigInt a,
BigInt m,
BigInt.Context t)
|
void |
multiplyBy(BigInt a,
BigInt.Context t)
|
void |
multiplyByPositiveInt(int w)
|
static BigInt |
product(BigInt a,
BigInt b,
BigInt.Context t)
|
void |
putBigEndian(byte[] a,
boolean neg)
|
void |
putBigEndianTwosComplement(byte[] a)
|
void |
putCopy(BigInt from)
|
void |
putDecString(String str)
|
void |
putHexString(String str)
|
void |
putLittleEndianInts(int[] a,
boolean neg)
|
void |
putLongInt(long val)
|
void |
putULongInt(long val,
boolean neg)
|
static int |
remainderByPositiveInt(BigInt a,
int w)
|
void |
setSign(int val)
|
static BigInt |
shift(BigInt a,
int n)
|
void |
shift(int n)
|
int |
sign()
|
static BigInt |
subtraction(BigInt a,
BigInt b)
|
void |
subtractPositiveInt(int w)
|
String |
toString()
Returns a string containing a concise, human-readable description of the
receiver. |
boolean |
twosCompFitsIntoBytes(int byteCnt)
|
dummy
static BigInt dummy
defaultContext
static BigInt.Context defaultContext
bignum
transient int bignum
BigInt
BigInt()
getCtx
static int getCtx(BigInt.Context t)
dispose
public void dispose()
finalize
protected void finalize()
- Description copied from class:
Object
- Called by the virtual machine when there are no longer any (non-weak)
references to the receiver. Subclasses can use this facility to guarantee
that any associated resources are cleaned up before the receiver is
garbage collected. Uncaught exceptions which are thrown during the
running of the method cause it to terminate immediately, but are
otherwise ignored.
Note: The virtual machine assumes that the implementation in class Object
is empty.
- Overrides:
finalize in class Object
toString
public String toString()
- Description copied from class:
Object
- Returns a string containing a concise, human-readable description of the
receiver.
- Overrides:
toString in class Object
- Returns:
- String a printable representation for the receiver.
getNativeBIGNUM
public int getNativeBIGNUM()
consumeErrors
public static int consumeErrors(StringBuilder sb)
cmp
public static int cmp(BigInt a,
BigInt b)
putCopy
public void putCopy(BigInt from)
copy
public BigInt copy()
putLongInt
public void putLongInt(long val)
putULongInt
public void putULongInt(long val,
boolean neg)
putDecString
public void putDecString(String str)
putHexString
public void putHexString(String str)
putBigEndian
public void putBigEndian(byte[] a,
boolean neg)
putLittleEndianInts
public void putLittleEndianInts(int[] a,
boolean neg)
putBigEndianTwosComplement
public void putBigEndianTwosComplement(byte[] a)
longInt
public long longInt()
decString
public String decString()
hexString
public String hexString()
bigEndianMagnitude
public byte[] bigEndianMagnitude()
littleEndianIntsMagnitude
public int[] littleEndianIntsMagnitude()
bigEndianTwosComplement
public byte[] bigEndianTwosComplement()
sign
public int sign()
setSign
public void setSign(int val)
twosCompFitsIntoBytes
public boolean twosCompFitsIntoBytes(int byteCnt)
bitLength
public int bitLength()
isBitSet
public boolean isBitSet(int n)
modifyBit
public void modifyBit(int n,
int op)
shift
public static BigInt shift(BigInt a,
int n)
shift
public void shift(int n)
addPositiveInt
public void addPositiveInt(int w)
subtractPositiveInt
public void subtractPositiveInt(int w)
multiplyByPositiveInt
public void multiplyByPositiveInt(int w)
divideByPositiveInt
public int divideByPositiveInt(int w)
remainderByPositiveInt
public static int remainderByPositiveInt(BigInt a,
int w)
addition
public static BigInt addition(BigInt a,
BigInt b)
add
public void add(BigInt a)
subtraction
public static BigInt subtraction(BigInt a,
BigInt b)
gcd
public static BigInt gcd(BigInt a,
BigInt b,
BigInt.Context t)
product
public static BigInt product(BigInt a,
BigInt b,
BigInt.Context t)
multiplyBy
public void multiplyBy(BigInt a,
BigInt.Context t)
bigExp
public static BigInt bigExp(BigInt a,
BigInt p,
BigInt.Context t)
exp
public static BigInt exp(BigInt a,
int p,
BigInt.Context t)
division
public static void division(BigInt dividend,
BigInt divisor,
BigInt.Context t,
BigInt quotient,
BigInt remainder)
modulus
public static BigInt modulus(BigInt a,
BigInt m,
BigInt.Context t)
modExp
public static BigInt modExp(BigInt a,
BigInt p,
BigInt m,
BigInt.Context t)
modInverse
public static BigInt modInverse(BigInt a,
BigInt m,
BigInt.Context t)
generatePrimeDefault
public static BigInt generatePrimeDefault(int bitLength,
Random rnd,
BigInt.Context t)
isPrime
public boolean isPrime(int certainty,
Random rnd,
BigInt.Context t)
Please submit a feedback, bug or feature