I created a method for creating a 128-bit UUID string, now I want to check if this is a prime or not. I cannot put a string in int because it is too big. Can anyone suggest how I will check?
This is the code I used to create the 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');
source share