Java examples for java.util:Random String
get Random Alpha Numeric String
//package com.java2s; import java.math.BigInteger; import java.security.SecureRandom; public class Main { public static void main(String[] argv) throws Exception { Integer bitsLength = 2;/*from www . j av a 2s . co m*/ System.out.println(getRandomAlphaNumericString(bitsLength)); } public static String getRandomAlphaNumericString(Integer bitsLength) { return new BigInteger(bitsLength, new SecureRandom()).toString(32); } }