Here you can find the source of generateRandom(Integer bitNum)
public static String generateRandom(Integer bitNum)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static String generateRandom(Integer bitNum) { if (bitNum == null) { bitNum = 32;/*from w ww .j a v a2 s . c o m*/ } String base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; Random random = new Random(); StringBuffer sb = new StringBuffer(); for (int i = 0; i < bitNum; i++) { int number = random.nextInt(base.length()); sb.append(base.charAt(number)); } return sb.toString(); } }