Class BigInteger
java.lang.Object
com.codename1.util.BigInteger
public class BigInteger
extends java.lang.Object
A simplified version of big integer from the bouncy castle implementation
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBigInteger(byte[] bval) BigInteger(int sign, byte[] mag) BigInteger(int bitLength, int certainty, Random rnd) BigInteger(int numBits, Random rnd) BigInteger(String sval) BigInteger(String sval, int rdx) -
Method Summary
Modifier and TypeMethodDescriptionabs()add(BigInteger val) and(BigInteger value) andNot(BigInteger value) intbitCount()intbyteclearBit(int n) intcompareTo(BigInteger val) intcompareTo(java.lang.Object o) divide(BigInteger val) booleanequals(java.lang.Object val) flipBit(int n) gcd(BigInteger val) intinthashCode()intintValue()booleanisProbablePrime(int certainty) return whether or not a BigInteger is probably prime with a probability of 1 - (1/2)**certainty.longmax(BigInteger val) min(BigInteger val) mod(BigInteger m) modPow(BigInteger exponent, BigInteger m) multiply(BigInteger val) negate()not()or(BigInteger value) pow(int exp) static BigIntegerprobablePrime(int bitLength, Random random) setBit(int n) shiftLeft(int n) shiftRight(int n) intsignum()subtract(BigInteger val) booleantestBit(int n) byte[]toString()toString(int rdx) static BigIntegervalueOf(long val) xor(BigInteger val) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Field Details
-
ZERO
-
ONE
-
-
Constructor Details
-
BigInteger
- Throws:
NumberFormatException
-
BigInteger
- Throws:
NumberFormatException
-
BigInteger
- Throws:
NumberFormatException
-
BigInteger
- Throws:
NumberFormatException
-
BigInteger
- Throws:
IllegalArgumentException
-
BigInteger
- Throws:
ArithmeticException
-
-
Method Details
-
probablePrime
-
valueOf
-
abs
-
add
- Throws:
ArithmeticException
-
and
-
andNot
-
bitCount
public int bitCount() -
bitLength
public int bitLength() -
compareTo
public int compareTo(java.lang.Object o) -
compareTo
-
divide
- Throws:
ArithmeticException
-
divideAndRemainder
- Throws:
ArithmeticException
-
equals
public boolean equals(java.lang.Object val) - Overrides:
equalsin classjava.lang.Object
-
gcd
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
intValue
public int intValue() -
byteValue
public byte byteValue() -
isProbablePrime
public boolean isProbablePrime(int certainty) return whether or not a BigInteger is probably prime with a probability of 1 - (1/2)**certainty.
From Knuth Vol 2, pg 395.
-
longValue
public long longValue() -
max
-
min
-
mod
- Throws:
ArithmeticException
-
modInverse
- Throws:
ArithmeticException
-
modPow
- Throws:
ArithmeticException
-
multiply
-
negate
-
not
-
pow
- Throws:
ArithmeticException
-
remainder
- Throws:
ArithmeticException
-
shiftLeft
-
shiftRight
-
signum
public int signum() -
subtract
-
toByteArray
public byte[] toByteArray() -
xor
-
or
-
setBit
- Throws:
ArithmeticException
-
clearBit
- Throws:
ArithmeticException
-
flipBit
- Throws:
ArithmeticException
-
toString
- Overrides:
toStringin classjava.lang.Object
-
toString
-
getLowestSetBit
public int getLowestSetBit() -
testBit
- Throws:
ArithmeticException
-