Class BigInteger
java.lang.Object
com.codename1.util.BigInteger
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) intdivide(BigInteger val) booleanflipBit(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)
-
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
-
compareTo
-
divide
- Throws:
ArithmeticException
-
divideAndRemainder
- Throws:
ArithmeticException
-
equals
-
gcd
-
hashCode
-
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
-
toString
-
getLowestSetBit
public int getLowestSetBit() -
testBit
- Throws:
ArithmeticException
-