Here you can find the source of randomStringNumbers(int len)
Parameter | Description |
---|---|
len | The length of the random string to be generated |
public static String randomStringNumbers(int len)
//package com.java2s; //License from project: Open Source License public class Main { /**Generate a string only with digits from 0 to 9, * randomically, with the length of len parameter. * @param len The length of the random string to be generated * @return A string with length len, with digits randomically * generated.*//* w ww. java 2 s. c o m*/ public static String randomStringNumbers(int len) { String s = ""; for (int i = 0; i < len; i++) s = s + (int) (Math.random() * 10); return s; } }