Here you can find the source of getRandomStr(int len)
public static String getRandomStr(int len)
//package com.java2s; //License from project: Open Source License import java.util.concurrent.ThreadLocalRandom; public class Main { public static String getRandomStr(int len) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < len; i++) { int num = ThreadLocalRandom.current().nextInt(10); sb.append(num);/*w ww .ja va 2s. c o m*/ } return sb.toString(); } }