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   www  . j  a v  a  2  s.  c  om*/

    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