personally, i dislike reading your code so i'm not going to debug it. i like to create extra functions to keep logic clear and to make testing a lot easier. since you're not really using a matrix concept, i like to think of 2D arrays simply as a single array of data (and that data just happens to be an array).
to merge two single arrays:
Code
double appendArrays(double[] array1, double[] array2){
double[] array = new double[array1.length + array2.length];
// copy array1 into our new array
System.arrayCopy(array1, 0, array, 0, array1.length);
// copy array2 after the first array
System.arrayCopy(array2, 0, array, array1.length, array2.length);
return array;
}
Now for each 2D array, i want to think of them as single arrays that have data in them. that data just happens to be another array. I'm assuming array1 and array2 have the same number of rows and nothing is null. you can compensate by yourself.
Code
void append2dArrays(double[][] array1, double[][] array2){
double[][] array = new double[array1.length][];
for (int i = 0; i < array.length; i++){
array[i] = appendArrays(array1[i], array2[i]);
}
}
then to print, do something similar. create a method that will print a single array, then another method loops through the 2D array and prints each row.
that's just how i'd do it. i dont know where your mistake is since i dont want to read through it