BigInteger クラスを使用して大きな素数をランダムに生成していますが、負の値を取得し続けています。負のリターンをすべて無視するにはどうすればよいでしょうか? フィックス10の数にするにはどうすればよいですか?
public class Gen{
public static void main(String[] args) throws IOException {
Random rand = new SecureRandom();
BigInteger.probablePrime(100, rand);
System.out.println(BigInteger.probablePrime(100, rand).longValue());
}
}