@Test
public void testMod() {

  final BigInteger TWO = BigInteger.ONE.add(BigInteger.ONE);
  for(long n = 3; n < 100; n++) {
    for (long e = 1; e < 100; e++) {
      final long r = TWO.modPow(
          BigInteger.valueOf(e), BigInteger.valueOf(n)).longValue();
      Assert.assertEquals("e=" + e + ", n=" + n, r, BaileyBorweinPlouffe
          .mod(e, n));
    }
  }
}