随机生成一个由大小写字母和数字组成的六位验证码
import java.util.Random;
/**
* 随机生成六位验证码工具类
* @author: whh
*/
public class VerificationCodeUtil {
public static String VerificationCode(){
String str="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
int codeLength=6;
StringBuilder sb=new StringBuilder(6);
for(int i=0;i<codeLength;i++)
{
char ch=str.charAt(new Random().nextInt(str.length()));
sb.append(ch);
}
return (sb.toString());
}
}