Check out example codes for "print 2d array in java". It will help you in understanding the concepts better.

Code Example 1

int[][] array = new int[rows][columns];
System.out.println(Arrays.deepToString(array));

Code Example 2

for (int row = 0; row < arr.length; row++)//Cycles through rows
{
  for (int col = 0; col < arr[row].length; col++)//Cycles through columns
  {
    System.out.printf("%5d", arr[row][col]); //change the %5d to however much space you want
  }
  System.out.println(); //Makes a new row
}
//This allows you to print the array as matrix

Learn ReactJs, React Native from akashmittal.com