Here you can find the source of getNumber(int length)
public static String getNumber(int length)
//package com.java2s; //License from project: Apache License import java.util.Random; public class Main { public static String getNumber(int length) { Random r = new Random(); String n = "0123456789"; String code = ""; for (int i = 0; i < length; i++) { code += n.charAt(r.nextInt(n.length())); }/* w ww.j a v a 2 s .com*/ return code; } }