class Exercise6 { // merges two sorted arrays a and b into a sorted result array c // ("sorted" means "sorted in ascending order") public static int[] merge(int[] a, int [] b) { int n = a.length+b.length; int[] c = new int[n]; int i = 0; int j = 0; int k = 0; while (k < n) { boolean aisnext = append(a, b, c, i, j, k); if (aisnext) i = i+1; else j = j+1; k = k+1; } return c; } // writes into c[k] either a[i] or b[j], whatever is smaller // returns true iff a[i] was written public static boolean append(int[] a, int[] b, int[] c, int i, int j, int k) { } }