Here you can find the source of randomString(int stringLength)
static String randomString(int stringLength)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { static String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; static Random rand = new Random(0); static String randomString(int stringLength) { StringBuffer s = new StringBuffer(); for (int i = 0; i < stringLength; i++) { int c = rand.nextInt(26); s.append(alphabet.charAt(c)); }//from w w w . ja va 2s. c o m return s.toString(); } }