码迷,mamicode.com
首页 > 其他好文 > 详细

系统自动生成ID(比UUID.radom().tostring()要好看)

时间:2016-08-19 18:52:02      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:

public class test1
{
    public static void main(String[] args) {
        char[] para = {‘A‘,‘B‘,‘C‘,‘D‘,‘E‘,‘F‘,‘G‘,‘H‘,‘I‘,‘J‘,‘K‘,‘L‘,‘M‘,‘N‘,‘O‘,‘P‘,‘Q‘,‘R‘,‘S‘,‘T‘,‘U‘,‘V‘,‘W‘,‘X‘,‘Y‘,‘Z‘,‘0‘,‘1‘,‘2‘,‘3‘,‘4‘,‘5‘,‘6‘,‘7‘,‘8‘,‘9‘};
        String result = new String();
        for(int i =0;i<32;i++){
            int c = new Random().nextInt(35);
            result += String.valueOf(para[c]);
        }
        System.out.println(result);
    }
}

 

系统自动生成ID(比UUID.radom().tostring()要好看)

标签:

原文地址:http://www.cnblogs.com/dbqjava/p/5788427.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!