//TODO 9.4 : Felder zusammenfuehren public static String[] zusammenfuegen(char[] firstcharFeld, char[] secondcharFeld) { String[] emptyArr = {}; if (firstcharFeld == null || firstcharFeld.length == 0 || secondcharFeld == null || secondcharFeld.length == 0) { return emptyArr; } int n1 = firstcharFeld.length; int n2 = secondcharFeld.length; String[] erg = new String[n1+n2]; int i = 0, j = 0, k = 0; // Traverse both array while (i < n1 && j < n2) { erg[k++] = String.valueOf(firstcharFeld[i++]); erg[k++] = String.valueOf(secondcharFeld[j++]); } // Store remaining elements of first array while (i < n1) erg[k++] = String.valueOf(firstcharFeld[i++]); // Store remaining elements of second array while (j < n2) erg[k++] = String.valueOf(secondcharFeld[j++]); return erg; } }