Java Random Number getSerialNumber(int length)

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

Description

get Serial Number

License

Apache License

Declaration

public static String getSerialNumber(int length) 

Method Source Code

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

import java.util.Random;

public class Main {

    public static String getSerialNumber(int length) {
        StringBuffer stringBuffer = new StringBuffer();
        Random random = new Random();
        for (int i = 1; i <= length; i++) {
            stringBuffer.append(random.nextInt(9) + 1);
        }//from   w  ww.j  av  a  2 s  .  c  o m
        return stringBuffer.toString();
    }
}

Related

  1. getRandomNumericString(int maxlen)
  2. getRandomPortNumber()
  3. getRandonNumber(int range)
  4. getrannumber()
  5. getRndNumByLen(int lengthOfNumber)
  6. getTenByteNumber()
  7. randomHexNumber(final int length)
  8. randomNumber(int length)
  9. randomNumber(int min, int max, Random r)