//Finished and tested code
//It was created based on refinement from several attempts (notably obtaining positive changes in Test case 28)
//And feeding it back into earlier iteration
//All Programiz challenge test cases have passed

//ALL FORMATTED INDENTED CORRECTLY

import java.util.*;
public class Solution {
    
    static List<List<Integer>> matrix = new ArrayList<>();
    static List<List <Integer>> nextMatrix;
    
    public static void main (String [] args)
    {
        List <List<List<Integer>>> testMatrix = new ArrayList<>(); 
        
        //TEST CASES
        //We have to ensure that the test case is a 3d array as oppose to a 2d array to contain all the matrixes
        
        //Integer [][][]test = new Integer[][][] {   {{1},{5}},{{9,88}}};
        
        //Only 1 matrix defined
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6}}}; 
        
        //As per challenge  - Test Case 1
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6}},  {{7,8},{9,10},{11,12}},  { {13,14}, {15,16} } }; 
        
        //As per challenge  - Test Case 2
        //Integer [][][]test = new Integer[][][] {   {{1,2,3,4}},{{5},{6},{7},{8}}};
        
        //As per challenge  - Test Case 3/4  (both same)
        //Integer [][][]test = new Integer[][][] {   {{1, 2}, {3, 4}}, {{5, 6}, {7, 8}}, {{9, 10}, {11, 12}}  };
        
        //TEST CASES EXPLORING JAGGED ARRAYS (variants of TEST CASE 28 IN Document)
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6}},  {{7,8},{10},{11,12}},  { {13,14}, {15,16} } };
        
        //TEST CASES EXPLORING JAGGED ARRAYS (variants of TEST CASE 28 IN Document) 
        //This relies on the matrixMultiplication initialisation
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6}},  {{7,8},{10,11},{11,12}},  { {13,14,17}, {15,16} } }; 
       
        //TEST CASES EXPLORING JAGGED ARRAYS (variants of TEST CASE 28 IN Document) 
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5}},  {{7,8},{10,11},{11,12}},  { {13,14,17}, {15,16} } }; 
        
        //TEST CASES EXPLORING JAGGED ARRAYS (variants of TEST CASE 28 IN Document) 
        //Integer [][][]test = new Integer[][][] {   {{1,2},{4,5,6}},  {{7,8},{10,11},{11,12}},  { {13,14,17}, {15,16,17} } }; 
        
        //TEST CASES EXPLORING JAGGED ARRAYS (variants of TEST CASE 28 IN Document)
        //This will get picked up on area of code I had written towards bottom part of code
        //Integer [][][]test = new Integer[][][] {   {{},{4,5,6}},  {{7,8,6},{10,14},{11,12}},  { {13}, {15,16} } }; 
    
        //HERE!!!!!!!!!!!!!!!!!!!!!!!! - NEED TO CHECK THIS!!!!
        //Integer [][][]test = new Integer[][][] {   {{1,2},{3,4},{5,6}},  {{7,8},{10,14},{0}},  { {13}, {15,16} } }; 
        
        
        //With this test case it has not performed jump to new column (FAIL)
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6}},  {{7,8},{9,10},{11,12}},  { {0}, {16,17},{5}} }; 
        
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6}},  {{7,8},{9,10},{11}},  { {13,14}, {16,17} } }; 
        
        //TEST CASES EXPLORING JAGGED ARRAYS (variants of TEST CASE 28 IN Document) 
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6}},  {{7,8},{9,2},{11,12}},  { {13,14}, {16,87},{3,4} } }; 
    
        //TEST CASES EXPLORING JAGGED ARRAYS (variants of TEST CASE 28 IN Document)
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6}},  {{},{10,14},{11,12}},  { {13}, {15,16} } }; 
       
        //TEST CASES EXPLORING JAGGED ARRAYS (variants of TEST CASE 28 IN Document)
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6}},  {{1,7},{25,14},{}},  { {13,15}, {15,16} } }; 
       
       //TEST CASES EXPLORING JAGGED ARRAYS (variants of TEST CASE 28 IN Document)
       //This will be handled validation in later part of code
       //Integer [][][]test = new Integer[][][] {   {{1,2,3},{}},  {{1,7},{25,14},{4,8}},  { {13,15}, {15,16} } }; 
       
       
       //-------------AMIT-------------------
       //TEST CASES EXPLORING JAGGED ARRAYS (variants of TEST CASE 28 IN Document
       //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6}},  {{1,7},{25,14},{4,8}},  { {}, {15,16} } }; 
       
        //TEST CASES EXPLORING JAGGED ARRAYS (variants of TEST CASE 28 IN Document)
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6}},  {{1,7},{25,14},{4,8}},  { {34,45}, {} } }; 
        
        //TEST CASES EXPLORING JAGGED ARRAYS (TEST CASE 28 IN Document exactly)
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6}},  {{7,8,6},{10,14},{11,12}},  { {13,14}, {15,16} } }; 
       
        //TEST CASES EXPLORING JAGGED ARRAYS (TEST CASE 28 IN Document exactly)
        //But it is error free, so informed end user excess numbers
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6}},  {{7,8},{9,10,14},{11,12}},  { {13,14}, {15,16} } }; 
        
        //TEST CASES EXPLORING JAGGED ARRAYS (TEST CASE 28 IN Document exactly)
       //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6}},  {{},{10,14},{11,12}},  { {13,14}, {15,16} } };
       
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6}},  {{11,14},{},{19,12}},  { {13,14}, {15,16} } }; 
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6}},  {{11,14},{44,55},{19,12}},  { {13,14}, {} } }; 
      
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6}},  {{11,14},{44,55},{19,12}},  { {13,14}, {0} } }; 
       
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6}},  {{11,14},{44,55},{19,12}},  { {13,14}, {0,5},{0} } }; 
        
       
        //TEST CASES EXPLORING JAGGED ARRAYS (TEST CASE 28 IN Document exactly)
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6}},  {{7,8},{10,14},{11,12}},  { {13}, {15,16} } }; 
       
        //ADDITIONAL TEST CASES
        
        Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6}},  {{7,8},{9,10},{11,12}},  { {13,14}, {15,16} },    { {17,18}, {19,20} },{ {17,18}, {19,20} }}; 
        
        
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6}},  {{7,8},{9,10},{11,12}},  { {13,14}, {15,16}},  { {17,18}, {19,20},{99,18}, {19,20}}, { {21,22,23,24}, {25,26,27,28},{29,30,31,32}} };
                                                                                            //AB=2 x 2
        
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6},{7,8,9}},  {{10,11,12},{13,14,15},{16,17,18}},  { {19,20,21}, {22,23,24}} };

        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6},{7,8,9}},  {{10,11,12},{13,14,15},{16,17,18}} };

        for (Integer [][] item: test)
        {
            matrix = new ArrayList<>();
                
            for (Integer [] row: item)
            {
                matrix.add(Arrays.asList(row));
            }
            testMatrix.add(matrix);
        }
        
        System.out.println("***FINAL OUTCOME***: \n" + matrixMultiplication(testMatrix));
    }
    
    public static List<List<Integer>> matrixMultiplication(List<List<List<Integer>>> matrices) 
    {
        int rowCounterNextMatrix;
        
        int seekPosition;
        int numWritesFirstIndexRowMultiplicationMatrix;
        StringJoiner matrixRowCalculations = new StringJoiner("");
        
        String rowEntry=null;
        String rowMatrix=null;
        String currentEntry=null;
        String prevEntry=null;
        
        StringJoiner excessRowReport = new StringJoiner("   ,");
        
        StringJoiner [][] matrixMultiplicationCalculations=null;
        
        int numWritesToLastIndexMultiplicationMatrix;
        
        boolean hasReachedEndRow=false;
        boolean hasStartedMultiplication=false;
        
        Integer multiplication;
        
        int rowCounterFirstMatrix=0;
        
        int rowsNextMatrix=0;
        int matricesSize=matrices.size();
        int counter=0;
        
        boolean hasStartMatrix=true;
        
        int numElementsInRow=0;
        boolean hasProcessed=false;
        
        int posPrevMatrixRowLevel=0;
        int numMatrixes=0;

        Integer [][]matrixMultiplication = null;
    
        List <List<Integer>> matrixMultiplicationList = new ArrayList<>();

        System.out.println("***ALL MATRIX*******: " + matrices.size());
        
        do
        {
            matrix=matrices.get(numMatrixes);
            
            System.out.println("\nMatrix" +"("+numMatrixes+"):");

            for (List<Integer> row: matrix)
            {
                System.out.println(row);
            }
            numMatrixes++;
            
        }while(numMatrixes<matrices.size());
        
        System.out.println("\n\n\n");
        numMatrixes=0;
        
        do
        {
            hasProcessed=false;
            matrix=matrices.get(counter);
           
            if (counter>0 && hasStartedMultiplication)
            {
                System.out.println("\n***SUMMARY****");
                System.out.println("Matrix multiplication: " + "Matrix ("+(counter-2)+") x Matrix ("+(counter-1)+")");
                
                if (matrices.size()!=2)
                {
                    System.out.println("ADDED Multiplication Matrix into the chain at index: " + (counter));
                    matrices.add(counter,matrixMultiplicationList);
                    hasStartedMultiplication=false;
                    System.out.println("Matrix("+counter+")");
                    
                    for (Integer []m: matrixMultiplication)
                    {
                        System.out.println(Arrays.toString(m));
                        
                        matrixMultiplicationList.add(Arrays.asList(m));
                    }
                
                    System.out.println("\n***CALCULATION STEPS*******");
                    
                    for (int q=0; q<matrixMultiplicationCalculations.length; q++)
                    {
                        matrixRowCalculations = new StringJoiner("");
                
                        for (int r=0; r<matrixMultiplicationCalculations[0].length; r++)
                        {
                            matrixRowCalculations.add(" ["+matrixMultiplicationCalculations[q][r]+"]");
                        }
                        System.out.println(matrixRowCalculations);
                    }
                    
                    System.out.println("\nIt will perform: " + "Matrix("+counter+")   x  Matrix("+(counter+1)+")");
                    
                    for (List<Integer> w: matrices.get((counter+1)))
                    {
                        System.out.println("\t\t\t\t"+String.valueOf(w));
                    }
                    
                    matricesSize=matrices.size();
                    
                    matrix=matrices.get(counter);
                }
            }
            System.out.println("\n\n------Matrix" +"("+counter+"):");
            
            matrix=matrices.get(counter);
            
            for (List<Integer> row: matrix)
            {
                System.out.println(row);
            }
            
            matrixMultiplicationList = new ArrayList<>();
            
            try
            {
                nextMatrix=matrices.get(counter+1);
            }
            catch (IndexOutOfBoundsException e)
            {
                System.out.println("Single matrix only");
                matrix=matrices.get(counter);
                System.out.println("\n***CALCULATION STEPS*******");
            
                for (List<Integer> row: matrix)
                {
                    System.out.println(row);
                }
                System.exit(0);
            }
            
            System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
            
            matrixMultiplicationCalculations=new StringJoiner[nextMatrix.get(0).size()][matrix.size()];
            
            System.out.println("Size of rows: " + nextMatrix.get(0).size());
            System.out.println("Size of cols: " + matrix.size());
            
            System.out.println("*******Customising Storage Grid for Multiplication Matrix**************************");
            
            for (int q=0; q<nextMatrix.get(0).size(); q++)
            {
                for (int r=0; r<matrix.size(); r++)
                {
                    System.out.println("Configuring for index: " + q + "," + r);
                    matrixMultiplicationCalculations[q][r] = new StringJoiner("+");
                }
            }
        
            for (List<Integer> ee: matrix)
            {
                rowMatrix = String.valueOf(ee);
                
                System.out.println("THIS IS ROW COUNTER MATRIX("+counter+"): " + rowCounterFirstMatrix);
                System.out.println("------------------------------------------THIS IS ROW DATA MATRIX("+counter+"): " + ee);
        
                hasProcessed=false;
                numWritesToLastIndexMultiplicationMatrix=0;
                hasReachedEndRow=false;
                
                for (int k=0; k<ee.size(); k++)
                {
                    if(counter!=matricesSize-1)
                    {
                        if (nextMatrix.get(0).size()==1)
                        {
                            hasProcessed=false;
                        }
                        
                        if (!hasProcessed)
                        {
                            rowCounterNextMatrix=0;
            
                            if (!hasStartedMultiplication)
                            {
                                System.out.println("****************************CONFIGURING SIZE FOR BLANK MULTIPLICATION MATRIX*******************************************");
                                matrixMultiplication = new Integer[nextMatrix.get(0).size()][matrix.size()];
                                
                                System.out.println("Matrix (W=" + matrix.size()+")  x  (H=" + nextMatrix.get(0).size()+")" 
                                + " configured to store Matrix " + counter + " x  Matrix " + (counter+1));
                               
                                try
                                {
                                    for (int a = 0; a < matrix.size(); a++) 
                                    {
                                        for (int b = 0; b < nextMatrix.get(0).size(); b++) 
                                        {
                                            matrixMultiplication[a][b] = 0;
                                        }
                                    }
                                }
                                catch (ArrayIndexOutOfBoundsException e)
                                {
                                    System.out.println("3The current dimension of matrixMultiplication: " 
                                    + "["+nextMatrix.get(0).size()+"],"+"["+matrix.size()+"]");
                                }

                                hasStartedMultiplication=true;
                            }
                            
                            List<Integer> rowInfo = new ArrayList<>();
                            
                            if (nextMatrix.get(0).size()==0)
                            {
                                System.out.println("8The current dimension of matrixMultiplication: " 
                                + "["+nextMatrix.get(0).size()+"]"+"["+matrix.size()+"]");
                                System.out.println("It EXPECTS: " + matrix.size() + " elements per row");
                                System.out.println("matrix" + "("+(counter+1)+")" + " row:" + rowCounterNextMatrix +  " " 
                                + nextMatrix.get(0) + " size: " + nextMatrix.get(0).size() + " invalidates this");
                                System.out.println(matrices);
                                System.exit(0);
                            }
             
                            for (int z=0; z<nextMatrix.get(0).size(); z++)
                            {
                                System.out.println("\n*****************Column number: " + z);
                                
                                posPrevMatrixRowLevel=0;
                                numWritesFirstIndexRowMultiplicationMatrix=0;
                                
                                for (int y=0; y<nextMatrix.size();y++)
                                {
                                    if (y<nextMatrix.get(0).size())
                                    {
                                         
                                        for (int m=0; m<nextMatrix.size(); m++)
                                        {
                                            for (int j=0;j<=nextMatrix.get(m).size();j++)
                                            {    
                                                if (m==0)
                                                {
                                                    rowCounterNextMatrix=0;
                                                }
                                                if (numWritesFirstIndexRowMultiplicationMatrix==nextMatrix.size())
                                                {
                                                  break;
                                                }
                                                else
                                                {
                                                    System.out.println("retrieving row: " + rowCounterNextMatrix 
                                                    + " from matrix (" + (counter+1)+")");    
                                                }
                                                rowInfo=new ArrayList<>(nextMatrix.get(m));
                    
                                                if (!hasReachedEndRow)
                                                {
                                                    seekPosition=0;
                                                    StringJoiner excessRowItems = new StringJoiner(",");
                    
                                                    if (rowInfo.size()!=matrixMultiplication[0].length)
                                                    {
                                                        currentEntry = "Row length:" + rowInfo.size()+" (matrix" + "("+(counter+1)+") row:" 
                                                        +rowCounterNextMatrix+ "   " + nextMatrix.get(m)+") "  
                                                        + " inconsistent with length expectations" 
                                                        + "("+matrixMultiplication[0].length+") in multiplcation matrix";
                        
                                                        if (!currentEntry.equals(prevEntry))
                                                        {
                                                            System.out.println(currentEntry);
                                                            excessRowReport.add(currentEntry);
                                                
                                                            for (int x: nextMatrix.get(m))
                                                            {
                                                                seekPosition++;
                            
                                                                if (seekPosition>matrixMultiplication[0].length)
                                                                {
                                                                    excessRowItems.add(String.valueOf(x));
                                
                                                                }
                                                            }
                                                        }
                                                    }
                                                    prevEntry = currentEntry;
                    
                                                    if (seekPosition!=0)
                                                    {
                                                        System.out.println("["+excessRowItems+"] are exempt from multiplcation matrix");
                                                        
                                                        if(excessRowItems.toString().length()==0)
                                                        {
                                                            System.out.println("99The current dimension of matrixMultiplication: " 
                                                            + "["+nextMatrix.get(0).size()+"],"+"["+matrix.size()+"]");
                                                            System.out.println("It EXPECTS: " + matrix.size() + " elements per row");
                                                
                                                            System.out.println("matrix" + "("+(counter+1)+")" + " row:" + rowCounterNextMatrix 
                                                            +  " " + "(content:"+nextMatrix.get(m) +")" + " size:" + nextMatrix.get(m).size() 
                                                            + " invalidates this");
                                                            System.out.println(matrices);
                                                            System.exit(0);
                                                        }
                                                    }
                                        
                                                    rowCounterNextMatrix++;
                                                    
                                                    try
                                                    {
                                                        System.out.println("Matrix["+(counter+1)+"] \trow element["+z+"]: " + rowInfo.get(z) +"\t\t" + nextMatrix.get(m));
                                                    }
                                                    catch (IndexOutOfBoundsException e)
                                                    {
                                                        System.out.println("24The current dimension of matrixMultiplication: " 
                                                        + "["+nextMatrix.get(0).size()+"],"+"["+matrix.size()+"]");
                                                        System.out.println("It EXPECTS: " + matrix.size() + " elements per row");
                                                        System.out.println("matrix" + "("+(counter+1)+")" + " row:" + rowCounterNextMatrix 
                                                        +  " " + nextMatrix.get(m) + " size: " + nextMatrix.get(m).size() + " invalidates this");
                                                        System.out.println(matrices);
                                                        System.exit(0);
                                                    }
                                        
                                                    try
                                                    {
                                                        System.out.println("Matrix["+counter+"] \trow element["+posPrevMatrixRowLevel+"]: " +ee.get(posPrevMatrixRowLevel) +"\t\t" + ee);
                                                    }
                                                    catch (ArrayIndexOutOfBoundsException e)
                                                    {
                                                        System.out.println("1The current dimension of matrixMultiplication: " 
                                                        + "["+matrixMultiplication.length+"],"+"["+matrixMultiplication[0].length+"]");
                                                            
                                                        if (rowInfo.size()>matrixMultiplication.length)
                                                        {
                                                            System.out.println("1Accessing matrix(" + counter+") row index: " 
                                                            + rowCounterNextMatrix + " from " + nextMatrix.get(m) + " invalidates this");
                                                            System.out.println("Remove " + nextMatrix.get(m) + " and rows beyond from matrix(" 
                                                            + (counter+1)+") row index: " + m);
                                                        }
                                
                                                        if (ee.size()<rowCounterNextMatrix)
                                                        {
                                                            System.out.println("2Accessing matrix(" + counter+") row index: " 
                                                            + rowCounterNextMatrix + " from " + ee + " invalidates this");
                                                            System.out.println("Remove " + nextMatrix.get(m) 
                                                            + " and rows beyond from matrix(" + (counter+1)+") row index: " + m);
                                                            System.out.println(matrices);
                                                            System.exit(0);
                                                        }
                                
                                                        if(ee.size()>matrixMultiplication.length)
                                                        {
                                                            System.out.println("It EXPECTS: " + matrix.size() + " elements per row");
                                                            System.out.println("matrix" + "("+(counter)+")" + " row:" + rowCounterFirstMatrix 
                                                            +  " " + matrix.get(rowCounterFirstMatrix) + " size: " 
                                                            + matrix.get(rowCounterFirstMatrix).size() + " invalidates this");
                                                        }
                                
                                                        if(nextMatrix.get(m).size()>matrixMultiplication[0].length)
                                                        {
                                                            System.out.println("It EXPECTS: " + matrix.size() + " elements per row");
                                                            System.out.println("matrix" + "("+(counter+1)+")" 
                                                            + " row:" + rowCounterNextMatrix +  " " + nextMatrix.get(m) + " size: " 
                                                            + nextMatrix.get(m).size() + " invalidates this");
                                                        }
                                                        
                                                        System.out.println(matrices);
                                                        System.exit(0);
                                                    }
                            
                                                    multiplication =  ee.get(posPrevMatrixRowLevel) *rowInfo.get(z);
                            
                                                    System.out.println(ee.get(posPrevMatrixRowLevel) + " X " + rowInfo.get(z) + "= " + multiplication);
                                                    
                                                    try
                                                    {
                                                        matrixMultiplication[rowCounterFirstMatrix][z] = matrixMultiplication[rowCounterFirstMatrix][z]  
                                                        + multiplication;
                                                    }
                                                    catch (ArrayIndexOutOfBoundsException e)
                                                    {
                                                        System.out.println("2The current dimension of matrixMultiplication: " 
                                                        + "["+nextMatrix.get(0).size()+"],"+"["+matrix.size()+"]");
                                                        System.out.println("It EXPECTS: " + matrix.size() + " elements per row");
                                                        System.out.println("matrix" + "("+(counter+1)+")" + " row:" + rowCounterNextMatrix +  " " 
                                                        + nextMatrix.get(m) + " size: " + nextMatrix.get(m).size() + " invalidates this");
                                                        System.out.println(matrices);
                                                        System.exit(0);
                                                    }
                                                    System.out.println("Value in multiplication matrix: " 
                                                    + matrixMultiplication[rowCounterFirstMatrix][z] + "\t\t" 
                                                    + "["+rowCounterFirstMatrix+"],["+z+"]" );
                                                    
                                                    numWritesFirstIndexRowMultiplicationMatrix++;
                            
                                                    
                                                    matrixMultiplicationCalculations[rowCounterFirstMatrix][z].add("(" + ee.get(posPrevMatrixRowLevel) 
                                                    + "x" +rowInfo.get(z) +" ="+String.valueOf(multiplication)+")");
                                        
                                                    System.out.println(matrixMultiplicationCalculations[rowCounterFirstMatrix][z]+"\n");
                            
                                                    if (z==(matrixMultiplication.length-1))
                                                    {
                                                        numWritesToLastIndexMultiplicationMatrix++;
                                                        
                                                        if (numWritesToLastIndexMultiplicationMatrix==nextMatrix.size())
                                                        {
                                                            hasReachedEndRow=true;
                                                        }
                                                    }
                                                    posPrevMatrixRowLevel++;
                                                    
                                                    break;
                                                }
                                                else
                                                {
                                                    System.out.println("---------------------------------------------------");
                                                    System.out.println("previous written to each index location of multiplication matrix: " 
                                                    + nextMatrix.size() + "  MAXIMUM times");
                                                    System.out.println("---------------------------------------------------");
                                                }
                                            }
                                        }
                                    }     
                                }
                            }
                            hasProcessed=true;
                        }
                        System.out.println("Processed ALL " + nextMatrix.get(0).size() + " columns in matrix["+(counter+1)+"] for " + "MATRIX("+counter+")  row("+rowCounterFirstMatrix+"): " + ee);
                    }
                                   
                    numElementsInRow++;
                }
            
                if(counter!=(matricesSize-1))
                {
                    for (List<Integer> rows: matrices.get((counter+1)))
                    {
                        rowsNextMatrix++;
                    }

                    if (numElementsInRow!=rowsNextMatrix)
                    {
                        System.out.println("INVALID VERIFICATION=>  columns " + "("+numElementsInRow+") in Matrix"  + "("+counter+")" 
                        + "(Row:" +rowCounterFirstMatrix + " content: " +  rowMatrix +  ") should match " 
                        +  rowsNextMatrix + " rows in matrix("+(counter+1)+")");
                        System.out.println(matrices);
                        System.exit(0);
                    }
                    else
                    {
                        System.out.println("VERIFICATION SUCCESSFUL(MATRIX("+counter+")  row("+rowCounterFirstMatrix+"))   =>   columns" + "("+numElementsInRow+")  in Matrix" + "("+counter+")"  
                        + " \t\trows("+rowsNextMatrix+")   in Matrix("+(counter+1)+")");
                    }
                    
                    rowsNextMatrix=0;
                }
                numElementsInRow=0;
                rowCounterFirstMatrix++;
            }
            rowCounterFirstMatrix=0;
                    
            counter=counter+2;

            hasStartMatrix=true;
            rowsNextMatrix=0;
            numMatrixes++;
        
        }while (counter<matricesSize);

        for (Integer []m: matrixMultiplication)
        {
            System.out.println(Arrays.toString(m));
        }
        
        System.out.println("\n***CALCULATION STEPS*******");
    
        for (int q=0; q<matrixMultiplicationCalculations.length; q++)
        {
            matrixRowCalculations = new StringJoiner("");
                
            for (int r=0; r<matrixMultiplicationCalculations[0].length; r++)
            {
                matrixRowCalculations.add(" ["+matrixMultiplicationCalculations[q][r]+"]");
                    
            }
            System.out.println(matrixRowCalculations);
        }
        
        for (Integer []m: matrixMultiplication)
        {
            matrixMultiplicationList.add(Arrays.asList(m));
        }
        
        System.out.println("\n"+excessRowReport);
        
        return matrixMultiplicationList;
    }
}