Here you can find the source of getRandomString()
private static String getRandomString()
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { private static final Random random = new Random(); private static final char[] chars = "abcdefghijklmnopqrstwyxz".toCharArray(); private static String getRandomString() { StringBuilder builder = new StringBuilder(); for (int i = 0; i < 10; i++) { builder.append(chars[random.nextInt(chars.length)]); }//from w w w .j av a 2 s . c om return builder.toString(); } }