Java - Write code to get random Number

Requirements

Write code to get random Number

Demo

//package com.book2s;

public class Main {
    public static void main(String[] argv) {
        System.out.println(randomNum());
    }/*from ww  w.  j a v  a2  s  .c  o m*/

    public static String randomNum() {
        String no = "";
        int a[] = new int[10];
        for (int i = 0; i < a.length; i++) {
            a[i] = (int) (10 * (Math.random()));
            no += String.valueOf(a[i]);
        }
        return no;
    }
}

Related Example