Java tutorial
//package com.java2s; //License from project: Apache License public class Main { public static String getRandomNumString(int length) { StringBuilder builder = new StringBuilder(); for (int i = 0; i < length; i++) { builder.append(String.valueOf((int) (Math.random() * 10))); } return builder.toString(); } }