MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;

public class MainClass {
    public static void main(String[] args) throws NoSuchAlgorithmException {
        int numBytes = (new Integer("1111")).intValue();
        long seed = 01;
        if (args.length > 1)
            seed = (new Long("1111111111")).longValue();
        SecureRandom srand = SecureRandom.getInstance("SHA1PRNG");
        if (seed != 01)
            srand.setSeed(seed);
        byte[] bytes = new byte[numBytes];
        srand.nextBytes(bytes);
        System.out.println(new String(bytes));
    }
}