Here you can find the source of generateRandom(Integer digits)
public static String generateRandom(Integer digits)
//package com.java2s; //License from project: Apache License public class Main { public static String generateRandom(Integer digits) { String s = ""; for (int i = 0; i < digits.intValue(); i++) { s = s + "0"; }/* w w w . j av a2s .c om*/ int multiplier = Integer.valueOf(1 + s).intValue(); int temp = (int) (Math.random() * multiplier); s = String.valueOf(temp); return s; } }