Here you can find the source of randomStr(long strLen)
public static String randomStr(long strLen)
//package com.java2s; //License from project: GNU General Public License public class Main { public static String randomStr(long strLen) { char freshChar; String freshString;// w w w. j a v a 2 s . c om freshString = ""; while (freshString.length() < (strLen - 1)) { freshChar = (char) (Math.random() * 128); if (Character.isLetter(freshChar)) { freshString += freshChar; } } return (freshString); } }