Here you can find the source of getNumString(int length)
public static String getNumString(int length)
//package com.java2s; //License from project: Apache License import java.util.Random; public class Main { public static final String NUMBERCHAR = "0123456789"; private static Random random; public static String getNumString(int length) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < length; i++) { sb.append(NUMBERCHAR.charAt(random.nextInt(NUMBERCHAR.length()))); }/*from w w w .j a v a2 s . c o m*/ return sb.toString(); } }