JAVA生成随机ID(UUID)

转载自:https://blog.csdn.net/zhengyikuangge/article/details/52669869


生成随机ID,经常在添加数据到数据库中使用

public static String getUUID(){
        UUID uuid=UUID.randomUUID();
        String str = uuid.toString(); 
        String uuidStr=str.replace("-", "");
        return uuidStr;
      }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

直接调用即可。


猜你喜欢

转载自blog.csdn.net/meng19910117/article/details/80911729