生成固定位数验证码的工具类
来源:互联网 发布:2017淘宝发货时间规定 编辑:程序博客网 时间:2024/06/05 15:22
生成固定位数验证码的工具类
package cop.panda.utils;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
public class Verify_Code {
/**
* This is a digital queue.
*/
public static final List NUMBER_LIST = Arrays.asList(new String[] {
“0”, “1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”, “9”
});/** * This is the lowerCase letter queue. */public static final List<String> LOWER_WORLD_LISt = Arrays .asList(new String[] { "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" });/** * This queue is all capital letters. */public static final List<String> UPPER_WORLD_LISt = Arrays .asList(new String[] { "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" });/** * This method is used to obtain the verification code. * * @param size * This parameter is the verification code length. * @return verifyCode */public static String getVerifyCode(int size) { List<String> list = null; Random random = new Random(); StringBuffer code = new StringBuffer(); for (int codeSize = 0; codeSize < size; codeSize++) { int choseArray = random.nextInt(3); list = (List<String>) (choseArray == 0 ? NUMBER_LIST : choseArray == 1 ? LOWER_WORLD_LISt : UPPER_WORLD_LISt); code.append(list.get(random.nextInt(list.size()))); } {// Release object memory. list = null; random = null; } return code.toString();}
}
0 0
- 生成固定位数验证码的工具类
- 生成固定位数的随机数
- 生成固定位数的UUID
- 随机生成指定位数的验证码
- 工具类-随机产生指定位数的验证码
- 随机生成固定位数的数字
- Mysql 生成固定位数的随机数
- java如何随机生成6位数的验证码
- java生成指定位数的随机验证码
- 生成含有字母数字任意位数的验证码
- 验证码生成工具类
- 验证码生成工具类
- 验证码生成工具类
- 生成验证码工具类
- 随机生成六位数验证码
- [PHP] PHP生成4位数验证码
- Java 随机生成六位数验证码
- 生成验证码的工具类和使用的servlet
- 09 - docker run 之 Wordpress+mysql快速搭建网站(Docker系列)
- Codeforces#383D. Arpa's weak amphitheater and Mehrdad's valuable Hoses(并查集+分组背包)
- spring MVC利用注解直接返回Json
- Android自定义圆形渐变进度条
- mongodb之索引
- 生成固定位数验证码的工具类
- iOS从零基础到精通就业-C语言入门 2 算数运算符
- Quartz源码——scheduler.start()启动源码分析(二)
- 10 - Dockerfile 之 tomcat中运行MyEclipse搭建Web项目(Docker系列)
- 【android开发】实现语音数据实时采集/播放
- WebView的简单使用和常用方法、属性!
- 11 - Dockerfile之容器中运行MyEclipse搭建的JavaWeb项目(Docker系列)
- Ionic持久化存储(一)
- jquery 监测鼠标滚轮