public class UniqueStringGenerator
{
private UniqueStringGenerator()
{
}
public static synchronized String getUniqueString()
{
if(generateCount > 99999)
generateCount = 0;
String uniqueNumber = Long.toString(System.currentTimeMillis()) + Integer.toString(generateCount);
generateCount++;
return uniqueNumber;
}
private static final int MAX_GENERATE_COUNT = 99999;
private static int generateCount = 0;
}
java唯一的字符串生成器
最新推荐文章于 2024-08-15 09:19:07 发布