@Test public void testModInverseSmallExhaustive() { for (int val = 10; val >= 0; --val) { for (int mod = 10; mod >= -1; --mod) { BigInteger bVal = BigInteger.valueOf(val); BigInteger bMod = BigInteger.valueOf(mod); try { BigInteger expected = bVal.modInverse(bMod); BigInteger actual = modInverse(bVal, bMod); assertEquals(String.format("val %d, mod %d", val, mod) + mod, expected, actual); } catch (ArithmeticException e) { try { modInverse(bVal, bMod); fail("ArithmeticException expected"); } catch (ArithmeticException expected) { } } } } }
public static BigInteger modInverse(BigInteger val, BigInteger modulus) { if (modulus.signum() <= 0) { throw new ArithmeticException("modulus must be positive"); } return INSTANCE.get().modInverseImpl(val, modulus); }
Gmp { public static BigInteger modInverse(BigInteger val, BigInteger modulus) { if (modulus.signum() <= 0) { throw new ArithmeticException("modulus must be positive"); } return INSTANCE.get().modInverseImpl(val, modulus); } }
Gmp { public static BigInteger modInverse(BigInteger val, BigInteger modulus) { if (modulus.signum() <= 0) { throw new ArithmeticException("modulus must be positive"); } return INSTANCE.get().modInverseImpl(val, modulus); } private  Gmp(); }
Gmp { public static BigInteger modInverse(BigInteger val, BigInteger modulus) { if (modulus.signum() <= 0) { throw new ArithmeticException("modulus must be positive"); } return INSTANCE.get().modInverseImpl(val, modulus); } private  Gmp(); static void checkLoaded(); static int kronecker(BigInteger a, BigInteger p); static BigInteger modPowInsecure(BigInteger base, BigInteger exponent,
      BigInteger modulus); static BigInteger modPowSecure(BigInteger base, BigInteger exponent, BigInteger modulus); static BigInteger modInverse(BigInteger val, BigInteger modulus); static BigInteger exactDivide(BigInteger dividend, BigInteger divisor); static BigInteger gcd(BigInteger value1, BigInteger value2); }
Gmp { public static BigInteger modInverse(BigInteger val, BigInteger modulus) { if (modulus.signum() <= 0) { throw new ArithmeticException("modulus must be positive"); } return INSTANCE.get().modInverseImpl(val, modulus); } private  Gmp(); static void checkLoaded(); static int kronecker(BigInteger a, BigInteger p); static BigInteger modPowInsecure(BigInteger base, BigInteger exponent,
      BigInteger modulus); static BigInteger modPowSecure(BigInteger base, BigInteger exponent, BigInteger modulus); static BigInteger modInverse(BigInteger val, BigInteger modulus); static BigInteger exactDivide(BigInteger dividend, BigInteger divisor); static BigInteger gcd(BigInteger value1, BigInteger value2);  }