Here you can find the source of generateRandomString(int n)
public static String generateRandomString(int n)
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { public static String generateRandomString(int n) { String alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; int length = alphabet.length(); String s = ""; Random r = new Random(System.currentTimeMillis()); for (int i = 0; i < n; i++) s += alphabet.charAt(r.nextInt(length)); return s; }/*from ww w .j av a 2 s . c o m*/ }