### Question:
Gmp { public static BigInteger exactDivide(BigInteger dividend, BigInteger divisor) { if (divisor.signum() == 0) { throw new ArithmeticException("BigInteger divide by zero"); } return INSTANCE.get().exactDivImpl(dividend, divisor); } private  Gmp(); static void checkLoaded(); static int kronecker(BigInteger a, BigInteger p); static BigInteger modPowInsecure(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);  }### Answer:
@Test public void testExactDivide() { assertEquals(BigInteger.valueOf(1), exactDivide(BigInteger.valueOf(1), BigInteger.valueOf(1))); assertEquals(BigInteger.valueOf(3), exactDivide(BigInteger.valueOf(9), BigInteger.valueOf(3))); assertEquals(BigInteger.valueOf(4), exactDivide(BigInteger.valueOf(12), BigInteger.valueOf(3))); Random rnd = new Random(); for (int i = 0; i < 100; i++) { BigInteger a = new BigInteger(1024, rnd); BigInteger b = new BigInteger(1024, rnd); assertEquals(a.gcd(b), gcd(a, b)); } }
@Test public void testExactDivideArithmeticException() { try { exactDivide(BigInteger.ONE, BigInteger.ZERO); fail("ArithmeticException expected"); } catch (ArithmeticException expected) { } }
@Test public void testExactDivideSmallExhaustive() { for (int a = 10; a >= -10; --a) { for (int b = 10; b >= -10; --b) { int p = a * b; BigInteger aVal = BigInteger.valueOf(a); BigInteger bVal = BigInteger.valueOf(b); BigInteger pVal = BigInteger.valueOf(p); if (a != 0) { assertEquals(String.format("a %d, b %d, p %d", a, b, p), bVal, exactDivide(pVal, aVal)); } else { try { exactDivide(pVal, aVal); fail("ArithmeticException expected"); } catch (ArithmeticException expected) { } } } } }