Java Math BigInteger.probablePrime() 方法 Java Math BigInteger.pow() 方法 Java Math BigInteger.remainder() 方法 Java Math BigInteger.probablePrime() 方法 package com.codingdict; import java.math.*; import java.util.*; public class BigIntegerDemo { public static void main(String[] args) { // create a BigInteger object BigInteger bi; // create and assign value to bitLength int bitLength = 3; // create a random object Random rnd = new Random(); // assign probablePrime result to bi using bitLength and rnd // static method is called using class name bi = BigInteger.probablePrime(bitLength, rnd); String str = "ProbablePrime of bitlength " + bitLength + " is " +bi; // print bi value System.out.println( str ); } } Java Math BigInteger.pow() 方法 Java Math BigInteger.remainder() 方法