首页 > 其他 > 详细

生成4位随机验证码工具类

时间:2018-09-26 16:29:28      阅读:132      评论:0      收藏:0      [点我收藏+]

keyUtil:

 

package com.duocy.util;

 

import java.util.Random;

 

public class keyUtil {
public String keyUtil() {
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;
}
}

 

 个人记录之用!

 

生成4位随机验证码工具类

原文:https://www.cnblogs.com/juzijiang/p/9707556.html

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