/** * Returns a {@code BigInteger} whose value is {@code this mod m}. The * modulus {@code m} must be positive. The result is guaranteed to be in the * interval {@code [0, m)} (0 inclusive, m exclusive). The behavior of this * function is not equivalent to the behavior of the % operator defined for * the built-in {@code int}'s. * * @param m the modulus. * @return {@code this mod m}. * @throws NullPointerException if {@code m == null}. * @throws ArithmeticException if {@code m < 0}. */ public BigInteger mod(BigInteger m){ if (m.signum() <= 0) { thrownew ArithmeticException("m.signum() <= 0"); } returnnew BigInteger(BigInt.modulus(getBigInt(), m.getBigInt())); }