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 {
    public synchronized static String getRandomCode(int length) {
        String sRand = "";
        for (int i = 0; i < length; i++) {
            Random random = new Random();
            String rand = String.valueOf(random.nextInt(10));
            sRand += rand;
        }
        return sRand;
    }
}