Here you can find the source of randomNum(int n)
public static int randomNum(int n)
//package com.java2s; //License from project: Apache License public class Main { public static int randomNum(int n) { return (int) (Math.random() * Math.pow(10, n)); }/*w w w . j a v a 2 s .c o m*/ }