Hi all,
I'm getting the mentioned exception while trying to merge two int arrays.
Here's the code..
public static int[] MergeArrays(int[] ArrayA, int[] ArrayB) { int ArrayAindex = ArrayA.length; int[] MergedArray = new int[ArrayA.length + ArrayB.length]; int MergedIndex = MergedArray.length; for (int x = 0; x < ArrayAindex; x++) { MergedArray[x] = ArrayA[x]; } int y; int z; for (y = ArrayAindex; y < MergedIndex; ArrayAindex++) for (z = 0; z < ArrayB.length; z++) { MergedArray[ArrayAindex] = ArrayB[z]; } for (int m = 0; m < MergedArray.length; m++) { System.out.print("MergedValues: " + MergedArray[m]); System.out.println(""); System.out.print(MergedArray[m]); } return MergedArray; }
Just cant seem to find out whats wrong...