List of utility methods to do BigInteger Value Check
boolean | isBigger(final BigInteger big1, final BigInteger big2) Returns whether the first BigInteger is bigger than the second. final int compared = big1.compareTo(big2); if (compared > 0) { return true; return false; |
boolean | isCovers(BigInteger covers, BigInteger value) is Covers return covers.compareTo(value) > -1;
|
boolean | isDefined(BigInteger no) Checking if the BigInteger is set. return no != null;
|
boolean | isElementOfZn(BigInteger element, BigInteger n) is Element Of Zn return (element.compareTo(BigInteger.ZERO) != -1) && (element.compareTo(n) == -1);
|
boolean | isEven(BigInteger x) is Even return !isOdd(x);
|
boolean | isFermatNumber(BigInteger f) Method to check if a given number is a Fermat number. if (f.signum() <= 0) return false; byte bytes[] = f.toByteArray(); int bLength = bytes.length - 1; if (bLength == 0) { switch (bytes[0]) { case 3: case 5: ... |
boolean | isGoodGaAndGb(BigInteger g_a, BigInteger p) is Good Ga And Gb return !(g_a.compareTo(BigInteger.valueOf(1)) != 1
|| g_a.compareTo(p.subtract(BigInteger.valueOf(1))) != -1);
|
boolean | isIn20PercentRange(BigInteger first, BigInteger second) is In Percent Range BigInteger five = BigInteger.valueOf(5);
BigInteger limit = first.add(first.divide(five));
return !isMoreThan(second, limit);
|
boolean | isInRange(BigInteger in, int range, double eps) Tests whether a given BigInteger is in the following range: [-2^range, 2^(eps * range)-1] (inclusive). if (((in.signum() > 0) && (in.bitLength() > (int) (eps * range)) && (in.compareTo(BigInteger.valueOf(1).shiftLeft(range)) > 0)) || ((in.signum() < 0) && (in.bitLength() > range) && (in.compareTo(BigInteger.valueOf(-1).shiftLeft(range)) < 0))) return false; return true; |
boolean | isInt(final BigInteger i) is Int return i.compareTo(MIN_INT) >= 0 && i.compareTo(MAX_INT) <= 0;
|