Java Random Number getNumber(int length)

Here you can find the source of getNumber(int length)

Description

get Number

License

Apache License

Declaration

public static String getNumber(int length) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Random;

public class Main {
    public static String getNumber(int length) {
        Random r = new Random();
        String n = "0123456789";
        String code = "";
        for (int i = 0; i < length; i++) {
            code += n.charAt(r.nextInt(n.length()));
        }/* w  ww.j  a v  a  2  s  .com*/
        return code;
    }
}

Related

  1. getNum(int length)
  2. getNumAndWord(int length)
  3. getNumber()
  4. getNumber()
  5. getNumber(int _nX0, int _nX1)
  6. getNumber(int length)
  7. getNumber(int length)
  8. getNumber(int seed)
  9. getNumberClose(int seed)