get Random String Number - Android java.util

Android examples for java.util:Random String

Description

get Random String Number

Demo Code


//package com.java2s;

public class Main {
    /**//from   w w  w . java  2 s .c  o m
     * @return Returns a random number in string format
     */
    public static String getRandomStringNumber(int length) {
        String number = "";
        for (int i = 0; i < length; i++) {
            number += "" + (int) (Math.random() * 10);
        }
        return number;
    }
}

Related Tutorials