Here you can find the source of generateString(int length)
public static String generateString(int length)
//package com.java2s; //License from project: Apache License import java.util.Random; public class Main { private final static String alphabet = "abcdefghijklmnopqrstuvwxyz1234567890"; private final static Random random = new Random(); public static String generateString(int length) { StringBuilder sb = new StringBuilder(); for (int k = 0; k < length; k++) { char c = alphabet.charAt(random.nextInt(alphabet.length())); sb.append(c);/*w w w .ja v a2 s . c o m*/ } return sb.toString(); } }