public static void insertion(int[] a) { for(int j = 1; i < a.length; j++) { int i = j - 1; int t = a[j]; while(i >= 0 && t < a[i]) { a[i+1] = a[i]; j--; } a[i+1] = t; } }