I'm trying to write a merge method that takes three arrays and moves them into one. I'm quite new to java and the website where I'm submitting this code isn't very helpful with pointing out my error
static int[] mergeArrays(int[] a1, int[] a2, int[] a3) {
int[] answer = new int[a1.length + a2.length + a3.length];
int i,j,k;
for (i = 0; i < a1.length; i++)
answer[i] = a1[i];
for (j = 0; j < a2.length; j++)
answer[i++] = a2[j];
for (k = 0; k < a3.length; k++)
answer[i++] = a3[k];
return answer;
}