So far I have done... the first class contains Insertion Sort algorithm
public class Sorting { public static void insertionSort(int[] r) { for ( int i = 1; i < r.length; i = i+1 ) {int v = r[i]; int j = i; while ( j != 0 && r[j-1] > v ) {r[j] = r[j-1]; j = j-1; } r[j] = v; } } } and here is the second class ...
import java.util.*; public class ExecutionTime{ public static void main(String[] args){ int size=30000; int[] r = new int[size]; int number=1; for(int i=1;i<size;i++){ r[i]=number; number++;} for(int i=1;i<size;i++){ System.out.println(r[i]);} Sorting.insertionSort(r); long result; long startTime = System.nanoTime(); long endTime = System.nanoTime(); result = endTime-startTime; System.out.println("Execution time is " + result + " nanoseconds"); } }