-2
我正在使用这段代码,我在netbean中试过可以运行,但是当我在eclipse中为android项目尝试时,它不起作用。我想随机获得公钥,但结果总是“35879”。如何在android中随机生成BigInteger.probablePrime?
publicKey = BigInteger.probablePrime(10, new Random());
while (phi.gcd(publicKey).compareTo(BigInteger.ONE) > 0 && publicKey.compareTo(phi) < 0) {
publicKey.add(BigInteger.ONE);
}