Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Random;

public class Main {
    static Random r = new Random();

    public static String randomCode(int length) {
        int seed = Double.valueOf(Math.pow(10, length)).intValue();
        return String.format("%0" + length + "d", (r.nextInt(seed)));
    }
}