首页 > 其他 > 详细

生成uuid

时间:2021-09-06 04:46:30      阅读:12      评论:0      收藏:0      [点我收藏+]

package com.neusoft.oss.utils;

import java.util.UUID;

/**

  • Created by yuanwai (lxdhzzj@gmail.com)

  • Create Time: 2015/6/9 14:50

  • Description: UUID生成器.
    */
    public class IdGen {

    public static String getUUID() {
    UUID uuid = UUID.randomUUID();
    String str = uuid.toString();
    String temp = str.substring(0, 8) + str.substring(9, 13) + str.substring(14, 18) + str.substring(19, 23) + str.substring(24);
    return temp;
    }
    public static String[] getUUID(int number) {
    if (number < 1) {
    return null;
    }
    String[] ss = new String[number];
    for (int i = 0; i < number; i++) {
    ss[i] = getUUID();
    }
    return ss;
    }

    public static void main(String[] args){

     System.out.println(IdGen.getUUID());
    

    }
    }

生成uuid

原文:https://www.cnblogs.com/XKDDUP/p/15228878.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!