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 { public static final String bigChar = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; public static String generateString(int length) { StringBuffer sb = new StringBuffer(); Random random = new Random(); for (int i = 0; i < length; i++) { sb.append(bigChar.charAt(random.nextInt(bigChar.length()))); }// w w w . ja v a 2s .com return sb.toString(); } }