<分区>
我已经创建了一个创建 128 位 UUID 字符串的方法,我现在想检查这是否是素数。我无法将字符串放入 int 中,因为它太大了。谁能建议我如何进行检查?
这是我用来创建 UUID 的代码
public static String uuid()
{
UUID uuid = UUID.randomUUID();
long hi = uuid.getMostSignificantBits();
long lo = uuid.getLeastSignificantBits();
byte[] bytes = ByteBuffer.allocate(16).putLong(hi).putLong(lo).array();
BigInteger big = new BigInteger(bytes);
String numericUuid = big.toString().replace('-','1'); // just in case
//System.out.println(numericUuid);
return(numericUuid);
}