Here you can find the source of generateRandomNum(int i)
public static StringBuffer generateRandomNum(int i)
//package com.java2s; import java.util.Random; public class Main { public static StringBuffer generateRandomNum(int i) { Random random = new Random(); StringBuffer num = new StringBuffer(); for (int j = 0; j < i; j++) { int numChild = random.nextInt(10); num.append(numChild);//from w w w . jav a2s . com } return num; } }