Here you can find the source of createParameters(int numberOfParameters)
public static Map<String, String> createParameters(int numberOfParameters)
//package com.java2s; //License from project: Open Source License import java.util.HashMap; import java.util.Map; import java.util.Random; public class Main { private static final char[] ALPHABET = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' }; private static final Random GENERATOR = new Random(); public static Map<String, String> createParameters(int numberOfParameters) { int defaultKeyLength = 8; // in rare case that number of parameters is greater than maximum of // possible keys while (numberOfParameters > Math.pow(ALPHABET.length, defaultKeyLength)) { defaultKeyLength *= 2;/*from w ww. ja va2s . co m*/ } Map<String, String> parameters = new HashMap<>(); for (int i = 0; i < numberOfParameters; i++) { parameters.put(generateAlphabetString(defaultKeyLength), generateAlphabetString(defaultKeyLength)); } return parameters; } public static String generateAlphabetString(int length) { char[] text = new char[length]; for (int i = 0; i < length; i++) { text[i] = ALPHABET[GENERATOR.nextInt(ALPHABET.length)]; } return new String(text); } }