Here you can find the source of generatePassword()
public static String generatePassword()
//package com.java2s; //License from project: Open Source License import java.util.Random; public class Main { private static String random_str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; public static String generatePassword() { String password = ""; for (int i = 0; i < 30; i++) { Random rand = new Random(); password += random_str.charAt(rand.nextInt(random_str.length())); }/*from w w w . j ava2 s . c om*/ return password; } }