标签:随机 next class out uid uuid port ati ret
UUIDUtils:
package com.duocy.util;
import java.util.Random;
import java.util.UUID;
/*生成随机字符串(code)工具类*/
public class UUIDUtils {
public static String getUUID() {
return UUID.randomUUID().toString().replace("-", "")+UUID.randomUUID().toString().replace("-","");
}
public static String findkeyUtil() {
String str="ABCDEFGHIJKLMNOPQRSTUVWXYZqwertyuiopasdfghjklzxcvbnm0123456789";
StringBuilder st=new StringBuilder(4);
for(int i=0;i<4;i++){
char ch=str.charAt(new Random().nextInt(str.length()));
st.append(ch);
}
String findkey=st.toString().toLowerCase();
System.out.println("生成找回的key为:"+st.toString());
return findkey;
}
}
个人记录之用!
标签:随机 next class out uid uuid port ati ret
原文地址:https://www.cnblogs.com/juzijiang/p/9707651.html