Here you can find the source of randomKey(int sLen)
public static String randomKey(int sLen)
//package com.java2s; /******************************************************************************* * ----------------------------------------------------------------------------- * <br>//from ww w . j a v a 2 s .co m * <p><b>Copyright (c) 2015 Quix Creation Pte. Ltd. All Rights Reserved.</b> * <br> * <br> * This SOURCE CODE FILE, which has been provided by Quix as part * of a Quix Creations product for use ONLY by licensed users of the product, * includes CONFIDENTIAL and PROPRIETARY information of Quix Creations. * <br> * USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS * OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH * THE PRODUCT.<br> * <br> * </p> * ----------------------------------------------------------------------------- * <br> * <br> * Modification History: * Date Developer Change Description * 07-May-2015 Jay * ****************************************** *********************************** */ public class Main { public static String randomKey(int sLen) { String base; String temp; int i; int p; base = "1234567890abcdefghijklmnopqrstuvwxyz"; temp = ""; for (i = 0; i < sLen; i++) { p = (int) (Math.random() * 37); if (p > 35) p = 35; temp += base.substring(p, p + 1); } return temp; } }