熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> Java開源技術 >> 正文

java唯一的字符串生成器

2022-06-13   來源: Java開源技術 

  public class UniqueStringGenerator

  {

  private UniqueStringGenerator()

  {

  }

  public static synchronized String getUniqueString()

  {

  if(generateCount > )

  generateCount = ;

  String uniqueNumber = LongtoString(SystemcurrentTimeMillis()) + IntegertoString(generateCount);

  generateCount++;

  return uniqueNumber;

  }

  private static final int MAX_GENERATE_COUNT = ;

  private static int generateCount = ;

  }


From:http://tw.wingwit.com/Article/program/Java/ky/201311/28152.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.