Java tutorial
//package com.java2s; import java.util.*; public class Main { /** * Generate array of Number * @param length int * @return String */ public static String generateNumber(int length) { String numbers = "0123456789"; String randomNumber = ""; Random random = new Random(); for (int i = 0; i < length; i++) { randomNumber = randomNumber + numbers.charAt(random.nextInt(numbers.length())); } return randomNumber; } }