Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.util.Arrays;
import java.util.Date;
import java.util.Random;

public class Main {
    public static void main(String[] args) {
        int[] anArray = new int[1000];
        Random generator = new Random();
        for (int i = 0; i < 1000; i++) {
            anArray[i] = (generator.nextInt(1000) + 1);
        }
        Date before = new Date();
        Arrays.sort(anArray);
        Date after = new Date();
        System.out.println("milli seconds" + (after.getTime() - before.getTime()));
    }
}