12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 /*
27 * @test
28 * @library ..
29 * @bug 8026236 8074460
30 * @summary test primality verification methods in BigInteger (use -Dseed=X to set PRNG seed)
31 * @author bpb
32 */
33 import java.math.BigInteger;
34 import java.util.BitSet;
35 import java.util.List;
36 import java.util.NavigableSet;
37 import java.util.Set;
38 import java.util.SplittableRandom;
39 import java.util.TreeSet;
40 import static java.util.stream.Collectors.toCollection;
41 import static java.util.stream.Collectors.toList;
42
43 public class PrimeTest {
44
45 private static final int DEFAULT_UPPER_BOUND = 1299709; // 100000th prime
46 private static final int DEFAULT_CERTAINTY = 100;
47 private static final int NUM_NON_PRIMES = 10000;
48
49 /**
50 * Run the test.
51 *
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 /*
27 * @test
28 * @library ..
29 * @bug 8026236 8074460
30 * @summary test primality verification methods in BigInteger (use -Dseed=X to set PRNG seed)
31 * @author bpb
32 * @key randomness
33 */
34 import java.math.BigInteger;
35 import java.util.BitSet;
36 import java.util.List;
37 import java.util.NavigableSet;
38 import java.util.Set;
39 import java.util.SplittableRandom;
40 import java.util.TreeSet;
41 import static java.util.stream.Collectors.toCollection;
42 import static java.util.stream.Collectors.toList;
43
44 public class PrimeTest {
45
46 private static final int DEFAULT_UPPER_BOUND = 1299709; // 100000th prime
47 private static final int DEFAULT_CERTAINTY = 100;
48 private static final int NUM_NON_PRIMES = 10000;
49
50 /**
51 * Run the test.
52 *
|