package com.raycloud.work.order.service.utils;
import org.apache.commons.codec.binary.Base32;
import java.security.SecureRandom;
public class UUIDUtils {
private static final SecureRandom random = new SecureRandom();
public static String newRandomId24() {
// 120 bit of randomness
// a Type 4 UUID has 122
// but multiples of 40 are nicer for BASE-32
// and 160 bits seems overkill (and inconvenient to type)
// this will make a 24 digit code
byte[] randomBytes = new byte[15];
random.nextBytes(randomBytes);
return new Base32().encodeAsString(randomBytes);
}
}
java工具类 ----UUIDUtils
最新推荐文章于 2024-10-02 06:05:51 发布

467

被折叠的 条评论
为什么被折叠?



