/**
* @Description:生成文件名的工具类包含0-9,a-z和A-Z
* @author: xiaojie
* @date: 2021.07.28
*/
public class StringUtils {
public static String getString(int length) {
char[] charArray = new char[length];
for (int i = 0; i < length; i++) {
Random r = new Random();
int n = r.nextInt(123);
while (n < 48 || (n > 57 && n < 65) || (n > 90 && n < 97) || n > 122) {
n = r.nextInt(123);
}
charArray[i] = (char) n;
}
return String.valueOf(charArray);
}
public static void main(String[] args) {
System.out.println(getString(15));
//dZFdmrv1p85gIfI
}
}