import java.util.Date; import java.util.Random; class QSortAlgorithm { static public void main(String args[]) { int n = Integer.parseInt(args[0]); int a[] = new int[n]; long time; initialize(a, n); System.out.println("Sorting "+n+" elements..."); time = (new Date()).getTime(); sort(a); time = (new Date()).getTime() - time; System.out.println("Sorted in "+time+" milliseconds."); } static void initialize(int a[], int n) { Random random; random = new Random(); for (int i=0; i < n; i++) { a[i] = random.nextInt(); } }