//Resilience and Continuous Analysis v3

//Finished and removed single nested loop (advised by chatGPT to reduce time complexity). Also removed if statement identifed previously. 
//Tested code but not extensively.
//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
//TERMS Matrix A and Matrix B will be used to discuss the pairing of the first and second matrix in transaction

//ALSO NOTE, in my comments, there is reference to Matrix A, Matrix B, Matrix C
//In absence of a Matrix C (references are to Matrix A and Matrix B)
//In presence of Matrix C (references are to Matrix A, Matrix B, Matrix C, Matrix, B, Matrix C........)

//ANY CATCH STATEMENT WHICH REQUIRES A MORE USER FRIENDLY MESSAGE CAN INCLUDE ONE OF THESE (IF REQUIRED)
/*
System.out.println("2Matrix("+(counter)+")" + "   row:" + ee +"\thas no content at index["+m+"]");
System.out.println("Hence can not perform multiplication with Matrix("+(counter+1)+")" + "   row:" + (rowCounterNextMatrix+1)+"\t" 
+  "  index["+z+"]: " + rowInfo.get(z));


System.out.println("1Matrix("+(counter)+")" + "   row:" + rowCounterFirstMatrix+"\t" +  "value at index["+z+"]: " + ee.get(posPrevMatrixRowLevel) 
+"  has no available supporting entry in \nMatrix("+(counter+1)+")" + "   row:" + (rowCounterNextMatrix+1)+"\t" +  "\t index["+z+"]: " + " row content:" + rowInfo);
*/


/*
//**********USAGE*************************
BEFORE CONFIGURING TEST CASES REMEMBER THESE CRITERIA AS MINIMUM:

Numbers columms in Matrix A/C  = Number rows in Matrix B 
Jagged arrays supported under validation rules
Size of largest row (number columns) in Matrix A/C and number rows in Matrix B will ALWAYS determine matrixMultiplication size 
//**********************************
*/

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} } }; 
        
        //Adaptation  Test Case 1
        //Integer [][][]test = new Integer[][][] {   {{1,2,3,5,6},{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,999},{10,11},{11,12}},  { {13,14}, {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
        //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} } }; 
       
        //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,9}},  {{7,8},{9,10},{11,12}},  { {13,14}, {15,16} } };
        
        //TEST CASES EXPLORING JAGGED ARRAYS BUT EXPLORING CHANGES IN MATRIX A (TEST CASE 28 IN Document exactly)
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4}},  {{7,8},{9,10},{11,12}},  { {13,14}, {15,16} } };
        
        //TEST CASES EXPLORING JAGGED ARRAYS BUT EXPLORING CHANGES IN MATRIX A (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,7,2,6}},  {{7,8},{9,10},{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}},  {{11,14},{44,55},{19,12}},  { {13,14}, {0} } }; 
        
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6}},  {{7,8},{10,14},{15,12,65,55}},  { {13,99}, {15,16} } }; 
             
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6},{7,8,9}},  {{10,11,12},{13,14,15},{16,17,18}},  { {}, {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}, {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}} };
                                                                                            
        //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}} };
        
        //active
        //Integer [][][]test = new Integer[][][] {   {{1,2,3},{4,5,6},{7,8,9}},  {{11,12},{13,14,15},{16,17,18}} };
        
        //Integer [][][]test = new Integer[][][] {   {{},{4,5,6},{7,8,9}},  {{10,11,12},{13,14,15},{16,17,18}} };
        
        //***********AI generates test cases  v3.4***********************************
        //Integer[][][] test = new Integer[][][] {{{1,2,3},{4,5,6},{7,8,9}},{{9,8,7},{6,5,4},{3,2,1}}};
        
        //Integer[][][] test = new Integer[][][] {{{1},{2,3},{4,5,6}},{{6,7},{8,9},{10,11}}};
        
        //Integer[][][] test = new Integer[][][] {{{1,2}},{{3},{4}},{{5,6}},{{7},{8}}};
        
        //Integer[][][] test = new Integer[][][] {{{1,2,3,4}},{{5},{6},{7},{8}}};
        
        //Integer[][][] test = new Integer[][][] {{{1,null,3},{4,5,null}},{{7,8},{9,10},{11,12}}};
        
        //Integer[][][] test = new Integer[][][] {{{}},{{1,2},{3,4}}};
        
        //Integer[][][] test = new Integer[][][] {{{1},{2},{3},{4}},{{1,2,3,4}}};
        
        //Integer[][][] test = new Integer[][][] {{{1}},{{2,3}},{{4},{5},{6}},{{7,8,9}}};
        
        //Integer[][][] test = new Integer[][][] {{{1,2},{3,4}},{{1,2},{3,4}},{{1,2},{3,4}}};
        
        //Integer[][][] test = new Integer[][][] {{{1,2,3,4,5}},{{6},{7},{8},{9},{10}}};
        
        //Integer[][][] test = new Integer[][][] {{{1,2},{3}},{{4,5,6}},{{7},{8,9}}};

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

        //Integer[][][] test = new Integer[][][] {{{1,2}},{{},{}},{{3,4}}};

        //Integer[][][] test = new Integer[][][] {{{1,2,3,4},{5,6,7,8},{9,10,11,12},{13,14,15,16}},{{16,15,14,13},{12,11,10,9},{8,7,6,5},{4,3,2,1}}};
        
        //Integer[][][] test = new Integer[][][] {{{1,2,3},{},{4,5}},{{6},{7,8},{9,10,11}}};
        
        //Integer[][][] test = new Integer[][][] {{{1,2,3},{4,5,6}},{{7},{8},{9}}};
        
        //Integer[][][] test = new Integer[][][] {{{3,1,8,null,0}},{{9}}};
        
        //***Stress diversity AI test cases - chatGPT
        
        //Integer[][][] test = new Integer[][][] {{{null},{5},{null,20,-5,null,8}},{{-5,7,-2,7,16},{-4,4,1}},{{null,-3,-4},{11,-1},{17,18}},{{3,18,16,14,4},{12,19,20,-3,null,null}}};
        //Integer[][][] test = new Integer[][][] {{{10,3,-1,null},{1,6},{null,10},{20}},{{7},{13,null},{19}},{{13,-2,5,null,null,null},{null,1,17,11,17},{},{8,-2,18,null,6},{20,null}}}; 
        //Integer[][][] test = new Integer[][][] {{{8,-5,10,16},{1,-2,10,1},{18,-3,-1,-2},{},{null,3}},{{6,null,-2,null,17,null}},{{12,14,7,11},{3,4,-5},{16,12,1,12},{}},{{15,6,2,5}}}; 
        //Integer[][][] test = new Integer[][][] {{{2,null,-3,6},{19,-2,20,11},{15,7,13},{null,7,16,3,1,20}},{{6,-3,null,16,-5},{10,null,6,null,4,0}},{{15,7}},{{-4,12,-3,-4},{},{0,1}}}; 
        //Integer[][][] test = new Integer[][][] {{{null,4,1,-2},{19,null,-3,9,-5,5},{15,16,18,-3,12}},{{null,5,2,1,-5},{1,19,6},{17,16}},{{3},{17,19,2},{},{},{1}},{{13,4,null},{0}}}; 
        //Integer[][][] test = new Integer[][][] {{{null,18,16,-2,12}},{{5},{6,15,8,-1},{null,7,15},{4},{0,null,6,12,null}},{{12,19,20,17,-3,7},{20,8},{null,20,-4,null},{1,12,6,8,13}}}; 
        //Integer[][][] test = new Integer[][][] {{{13,18,null,13}},{{18,1},{19}},{{17}},{{13,-5},{},{20,1,14},{2,8,17,4,20,null}},{{18},{3,6,-1,8,18,13},{1}}};
        //Integer[][][] test = new Integer[][][] {{{},{4,11,17,14},{}},{{16,3},{},{8,15,18,12,1}}};
        //Integer[][][] test = new Integer[][][] {{{11,16,null,12}},{{}},{{null,-2,-3,11,15},{-5,6,null,17,10,1}},{{4,20,20,18},{18,18,19,-5}},{{12,10},{17,17,18},{6,7,10,19},{-5,-5}}};
        //Integer[][][] test = new Integer[][][] {{{7}},{{18},{15},{11,10},{16,9,0,2,9}},{{-5,16}},{{18},{12,-3,14,7,-1,4},{7},{9,10,4,15}}};
        //Integer[][][] test = new Integer[][][] {{{20,-1,-2,10,15,null},{-4,4},{1,13,18,17,13,6},{3,7},{19}},{{7,-3,19,2,6}}};
        //Integer[][][] test = new Integer[][][] {{{18,9},{null,19,null,-4,null},{2,8,1,16}},{{1,-3,-5,null,0,6}},{{10,13,19,0}},{{18,3,0,0},{3,14,17,1,-4,19},{13}},{{1,10,null,3,6}}}; 
        //Integer[][][] test = new Integer[][][] {{{null,20},{12,18},{-2,null,0,14,3,3},{17},{}},{{18},{},{6,0,-2,19,-2}},{{18,2,1,null,null,20},{null},{11,-3,6,11,5},{17,6}}}; 
        //Integer[][][] test = new Integer[][][] {{{null,null,13}},{{4,3,9,19},{},{13,9,1}},{{6,-3,4,2},{9,19,2,11,3},{14,-3,10},{-2,12}},{{},{4,-2},{},{7},{16}}}; 
        //Integer[][][] test = new Integer[][][] {{{4,14,0,1,7,10}},{{-1,4,3,-1}},{{20},{5,-4,17}},{{0,3,11,12,null,2},{-3,-2,7},{12,10,null,13,-2},{8,-3},{-2,7,7,5}},{{19,9,10},{11}}}; 
        //Integer[][][] test = new Integer[][][] {{{7,-5}},{{13,7,-4,16,null,-5},{6,3,-5,9,7,15}},{{-1},{0,-1,19,null}}};
        //Integer[][][] test = new Integer[][][] {{{11,-2,6,4},{8,2,19,13},{5,16,-2}},{{9,19},{8,-5,-2,0},{3,null,12}},{{10},{9,4,12,15},{2,11,10,-3,14}},{{10,13,4,2,null,19}},{{14}}}; 
        //Integer[][][] test = new Integer[][][] {{{-1,2,16,15,16,12},{null,1,5}},{{17},{15}},{{18,-5,5}},{{-5,13,13,2,6,17},{null,-2,9,13,17,-5},{}},{{},{2,0}}}; 
        //Integer[][][] test = new Integer[][][] {{{1},{7},{20},{8,20,9},{1,16,-1}},{{4},{20,-2,1,20,-4},{7,8,null,null},{-3,9,11}},{{9,-3,-2,2,0,4},{},{2,0,-4,10,null},{null,0,15,7}}}; 
        //Integer[][][] test = new Integer[][][] {{{}},{{},{-1,2,-2}},{{2},{10,15,3,-3}},{{-2,1,12,3,null},{-2,0,-5,16},{4,-2,-1}},{{15,17,15,-1},{7,null,17},{10},{11,-2,17}},{{15,1 
        //Integer[][][] test = new Integer[][][] {{{12,null,19},{},{5,14,9,1,-2,4}},{{16,18},{9,1,10,12,1},{6,2}}};
        //Integer[][][] test = new Integer[][][] {{{17,10,8,6,-4},{5,7},{-3},{null,3,2,10,19,6},{3}},{{-2,18},{2},{},{}},{{20,-4,8,3,5}},{{-5},{2,15},{15,null,0,4,-5,19}},{{}}};
        //Integer[][][] test = new Integer[][][] {{{-5,3,1,13},{19,0,15,8},{16,3,-3,-5},{10}},{{},{19,null,2,18},{null,19,11,18,15}},{{-3,null,12,13},{15},{15,11,-2},{10}},{{9,-5}}}; 
        //Integer[][][] test = new Integer[][][] {{{-2,17,4},{null,-4}},{{-4,13,-3,11},{4,null}}};
        //Integer[][][] test = new Integer[][][] {{{},{null,null,-4,0},{14},{}},{{12,-1,17,2},{-4,-5,null,20,-5},{-2,-5,18},{8,20,4,12,14},{17}},{{-4,8,14,11,9},{5,7,17,2,5},{14,-3}}}; 
        //Integer[][][] test = new Integer[][][] {{{11},{13,5,-1,10,2},{10,12,20,10,9},{12,null,7,16,11,5}},{{},{}}};
        //Integer[][][] test = new Integer[][][] {{{11,null,4,null},{-2,7,3},{null},{1,-1,9,17,8}},{{-1,18,15,12,null},{null,-4,18,null,-4,7},{-2,3,-5,17,12,2}},{{-3,20,4,null,10}}};
        //Integer[][][] test = new Integer[][][] {{{14,-2,6,11,19,10},{16,15,11},{null}},{{},{},{13,-4,11,-1,-2}},{{4,16,7,1,17},{5,4},{-4,9,null,10},{2,4,11,null,20,12}},{{-1,13,7}}};
        //Integer[][][] test = new Integer[][][] {{{10,null,7,-2},{18,null,-2,14,null,16}},{{null,19,3,-3,3,13}},{{6,null,13,8,14,12},{11,16,14,null}},{{8,20},{20}}}; 
        //Integer[][][] test = new Integer[][][] {{{0,7,6,13},{-1},{11,null,6},{14,2,-4,null}},{{8,null,-1,13}},{{15},{13,14,1,-4},{16,null,14,15},{8,10,5,10,13}},{{},{10,null,15,4}}};
        //Integer[][][] test = new Integer[][][] {{{20,20,20,null,-4},{10,-2,null,2,13}},{{16,18,15,12},{10,11,null,17},{-2}},{{-2,7,19,5}},{{2},{-3,0,18,-4,10},{7,8,15},{19,10,8,9}}};
        //Integer[][][] test = new Integer[][][] {{{},{15},{-1,-3,null,14,-4,-3},{15,14,13,-4,7,-1}},{{1,18,9,6,11},{0,null},{3,11,-5,-5,5,17}},{{5,-5}},{{},{0,null},{}}}; 
        //Integer[][][] test = new Integer[][][] {{{5,20,0,0},{5,16,20,10,6}},{{20,19,12},{12,12,13,4},{1},{8,12,-5},{null,10,9,0}},{{9,7,14,-2,-3,0},{-4,-3,-4,4,4},{17,13,null,1,-1}}};
        //Integer[][][] test = new Integer[][][] {{{5,6,-3,14,null},{1,13},{20,null,6},{},{2,null,null,null,4}},{{16,1,10},{6,10,20,11,null}}};
        //Integer[][][] test = new Integer[][][] {{{-5}},{{3,2,13,4,-2,15},{8,7}}};
        //Integer[][][] test = new Integer[][][] {{{-2,-3,-4,6,12,11},{19,6},{null,18,18},{},{14,-5}},{{15,2}},{{10,7},{null,14,11,16,11},{13,null}},{{20,10,9},{12,4,-5,8},{4},{null}}}; 
        //Integer[][][] test = new Integer[][][] {{{},{13,2},{},{11}},{{-3,16,1},{13,16,-3},{-2,null,13,19}},{{19,14,19,null,null},{-2,15,10,4,-3},{-5,12,null,0,6}}}; 
        //Integer[][][] test = new Integer[][][] {{{4},{1,13,null,1,13}},{{-4},{},{11,null}}};
        //Integer[][][] test = new Integer[][][] {{{}},{{15,19,-5,-1,15},{16,-3,-5},{-5}},{{15,8,4,19},{17,13,9},{17},{12,19,9,15},{20}},{{-3}}};
        //Integer[][][] test = new Integer[][][] {{{2,6,null,3,-4,20},{8,7,18,-2,null,1},{},{-5,-4},{-4,16,null}},{{17,-2,11,9,18,18},{2},{}},{{-2,null,1,3,-2,-5},{17,null,14,-5,-5}}}; 
        //Integer[][][] test = new Integer[][][] {{{11},{-2,2,-1,null},{},{null,9,null,4}},{{16,0,10},{3,7},{11,4,18,17,-3},{17},{-4,null,-1}},{{15,null},{18},{3}},{{},{3,0,0},{null}}}; 
        
        //check
        //Integer[][][] test = new Integer[][][] {{{11,16,2,7},{}},{{null,12,0,-5},{13}},{{}},{{}},{{3,9,11},{null},{19,4,7},{null,null,0,-2,-5},{1,14,null,4}},{{0,7,6,-4,14,20}},{{}}}; 
        //Integer[][][] test = new Integer[][][] {{{-2,5},{},{9,12,7,11},{13,null,17}},{{18},{3},{11,3,-2}},{{3,13},{3,12},{14}},{{18,6,null,-3},{0,-5,null,-3,-1}},{{17,7,8,7,17}},{}}; 
        //Integer[][][] test = new Integer[][][] {{{16,null,null,1,16,14},{5,9,18,-2,-5},{11,3,7,2,7,null},{1}},{{null},{-4,7,18,7},{-3,19,16},{14,-4,8,10}},{{},{}},{{4,20}},{{13},{}}}; 
        
        //Integer[][][] test = new Integer[][][] {{{10,8,4,-4,11},{4,null,12,null,14},{13,15,10,2},{18},{6,1,1,-3,18}},{{null,17,null}},{{17,9,3,null,null},{0,3,11,14,1,5},{-3,18},{}}}; 
        //Integer[][][] test = new Integer[][][] {{{null,4,null},{14,15}},{{-1},{}},{{null,6,6,6,20}},{{4,15}},{{13,8,10,5},{10,19,15,1,-2,12},{5},{0,null,4,null,10,10},{-2}},{{5,2}}}; 
        //Integer[][][] test = new Integer[][][] {{{16,5,16},{null,4}},{{20,13,7,5,4,6},{3,10}},{{5,15},{-3,10,1,-1},{11,19,-2,-5,1},{3,-5,16},{10}},{{10}},{{10,18,null,null,1},{null}}}; 
        //Integer[][][] test = new Integer[][][] {{{},{-5,17},{7,4,7,-2,0}},{{-2},{},{-3,5,17}},{{11,null,-4,2,10,2},{-3,-4,null},{-4,1,9,11},{null,-3,null,-2},{}},{{6,2,-2,16,-1,null}}};
        //Integer[][][] test = new Integer[][][] {{{20,17},{-1,19,2},{2,5}},{{null,null,5,0,null},{-2,12,-5,6,3},{16,2},{},{}}};
        //Integer[][][] test = new Integer[][][] {{{3,7,10},{15,null},{9,5},{-4,null,-4,5,7,8},{-4,7,null,10}},{{-1,0,20,-3,null},{17,null,13,null,-3,11},{},{10,null,null}},{{null}}};
        //Integer[][][] test = new Integer[][][] {{{11,null,3,13,1},{-4}},{{18,8},{},{},{13}},{{8,19,19,8,17,3},{10,3,4}}};
        //Integer[][][] test = new Integer[][][] {{{-3,7,20},{1,1,null,15,8,8},{16},{null,17,15,null}},{{},{20,-2},{null,15,-2,19,4}},{{6,12},{}},{{2}},{{-4,-2,4},{17,-1},{},{},{13}}}; 
        //Integer[][][] test = new Integer[][][] {{{8,null},{5,null,7,2,-5}},{{4,null,-5,9},{},{-1,5,-4,18,3,9},{19},{3,null,null,18}},{{18,-3},{17,-1,9,6,18,-1},{-1}},{{-5,0,null,1}}};
        //Integer[][][] test = new Integer[][][] {{{1,10,19,3,7}},{{-4,12,1,19,2},{9,10},{},{12,null},{5,0,12,19}},{{-3,13},{},{},{2,5},{null}},{{-4,3},{-4,1,20,0,3,11},{6,3,18,5,-3}}}; 
        //Integer[][][] test = new Integer[][][] {{{-5,-4,3},{12,-1,14,12,-5,3}},{{1},{null,8,19},{5,-4,11,4},{-2,-4}},{{12,8,-2,-5},{},{},{7},{null,15,12,8,10,2}},{{3,-2,11}},{{1}}};
        //Integer[][][] test = new Integer[][][] {{{20,13,6,1,3}},{{7,-2,0,16,8,-4},{null,13,0},{},{15},{}},{{16,5,-3,9,4}},{{16,10,14},{null},{10}},{{-3,19},{2,0,11,0},{},{-3,18,12}}};
        //Integer[][][] test = new Integer[][][] {{{4,null,6,-5},{19},{-1,10,null,9}},{{-5,-3},{},{}},{{18,7},{8,17,5},{},{20,null,-2},{14,20,19,1,null}},{{18},{-4,2,0,17},{null,18}}};
        //Integer[][][] test = new Integer[][][] {{{},{-1,8,2}},{{1,1,12,2,7},{18,19,-4,11,8,11}},{{4,8},{2,4},{5,null,14,14,0,11}},{{-1,12},{-2}},{{3,12,null,4,16,11},{4,2,19,5},{1}}}; 
        //Integer[][][] test = new Integer[][][] {{{-4,9,12,19},{}},{{null,17,11,0,8,1},{15,1,5},{20,10},{1,-2,5,20,8},{}},{{18,-2,5,-2,17,15},{12},{5,17,3,-2,7,10},{5,-3}},{{},{15}}}; 
        //Integer[][][] test = new Integer[][][] {{{0,9,7,14},{4,9,null,null,-1},{-2},{10,12,3},{10,13,5,-1,18,17}},{{0},{-3,6,4,9,12},{11},{1,-3,8,4,2,4},{4}},{{},{19,10,0,13},{null}}};
        //Integer[][][] test = new Integer[][][] {{{-1,17,14,5,12,12},{5,17,3,9}},{{},{15,5,-1,1,14},{5,4,3,null,7,-4},{19,-3},{}}};
        //Integer[][][] test = new Integer[][][] {{{-3,12,-1,-2},{19},{2}},{{-1,-2,5},{6}},{{4,1,null,12,5,5},{1,8,-1},{},{-4,2,14,null,14},{0,10}},{{18,6,-1},{16,13,7,15,8,8},{0,6}}}; 
        //Integer[][][] test = new Integer[][][] {{{16,-3,-1,12},{0,-5,-4,3,6,-2},{19,10}},{{},{9,20,5,-2,11,-4},{},{7,-1,19,null}}};
        //Integer[][][] test = new Integer[][][] {{{20,12}},{{},{null,3,13,16,15,13},{17,4,9,20},{10,6,null,-5,16}}};
        //Integer[][][] test = new Integer[][][] {{{9,6,9}},{{null,11,19},{8},{9,null,11},{13,-3}}};
        //Integer[][][] test = new Integer[][][] {{{null,-3}},{{18,12,null,1,12},{-5,20,-5,-5},{7,8,12}},{{18,20,18},{20,-2,-5,5,9,8},{-5,16,8,12,-2}},{{6,1,9,1,13,null},{16,-1,10,7}}};
        //Integer[][][] test = new Integer[][][] {{{10,18,null,8,-1},{null,10},{8,20}},{{0,2},{},{1,15,5,5},{6,-1,-4,20,6,5},{-2,null}},{{},{18,null,null,11},{19,3,7,0},{null},{-1,7}}};
        //Integer[][][] test = new Integer[][][] {{{-3,-1,8},{17,-2},{6,19,-5,9,20},{null,6,14}},{{8},{1,null,-3,4,19},{2},{}},{{15,12,null},{4,16,18,-3},{4,-1,-4,13}},{{8,10,null}}}; 
        //Integer[][][] test = new Integer[][][] {{{-5,14,1,null,14,6},{},{20,4}},{{-2},{11,null,null,12,-5,14},{-4,12,7,5,-2},{1,17,12,18,16,6},{}},{{7,9,15,-2},{2},{12,-5,0,13},{3}}}; 
        //Integer[][][] test = new Integer[][][] {{{6,8,-3,-4,16,-4},{-2,5,13,6,6},{-4,null,3},{2,null,6,10},{}},{{-1,4,12,12,14,14},{9,19},{null},{7}},{{15,3},{4,null,4,6,8},{10,-4}}};
        //Integer[][][] test = new Integer[][][] {{{14,15,null,2},{7,null}},{{null,4,9,-1,5,-3},{10,-4,3,18,12}},{{2,19,5,15,15},{null,19},{6,17,14,null},{1,null,null},{-3,8,0,16,7}}};
        //Integer[][][] test = new Integer[][][] {{{-1,12,-4,10}},{{3,19,null,8,15},{7,5,8},{20,19},{15}}};
        //Integer[][][] test = new Integer[][][] {{{null,null,18,null,2,17},{16,13,3,5,7},{},{}},{{5,null,8},{10,null,-3,15,-5},{null,8,-2,-1,-5},{-5,3,2,-2,null},{null,-3,-1,8,-1,1}}}; 
        //Integer[][][] test = new Integer[][][] {{{null},{1,19,19,7},{}},{{0},{null,null,null,9,13},{13,20,-2},{-5,5,19,0,0},{null,-1}},{{15,18,19,8,19,8},{2,1,8},{0}}}; 
        //Integer[][][] test = new Integer[][][] {{{8,10},{5,7,4,-4},{9,3,-4,19}},{{5,12,-3,0},{null,null,10,-3},{-2,15,13,2,null}},{{2,15,null,0,null},{13,2,14,-1},{8,15,-1,1,-2},{}}};
        //Integer[][][] test = new Integer[][][] {{{},{14,15,null,-3},{1,10,16,18,7,-3}},{{},{-4,13},{-5,-1},{18,-2}},{{},{17,20,-5,10,7,null},{11,-4,5,-4,7,8}},{{},{},{18},{7,-2,7}}};
        //Integer[][][] test = new Integer[][][] {{{9,7,9,4},{13,4},{15,8,-2,10,null},{1,5,10,8,0,-3},{5,-4}},{{null,17,0,-2,16,-1},{13,18,18,14},{null,10}},{{7,17,0,3,3},{10,8,13,3}}};
        //Integer[][][] test = new Integer[][][] {{{16,0,null}},{{-4,-2},{0,null,-4,17,-2,19},{-1,18,-2,10,-4},{3,17,-5}},{{2,null,6,13,null},{20,15,8,null,12,1},{}},{{2,11},{10,11}}};
        //Integer[][][] test = new Integer[][][] {{{2,0,8},{},{10,2,-1}},{{2,15,14,9,-1},{2,10,13,-5,18},{20,null,3,-3,9}},{{0,-5,11,0,13}},{{7,-5,4,-3,6}},{{2,16},{null,12,18,4,-3}}}; 
        //Integer[][][] test = new Integer[][][] {{{-3,10,-4,8,null,1}},{{15},{},{18,19},{8,-2,13,3,-5,-1}},{{}},{{4,1,16,5},{9,-2,2,19,15,7}},{{7,null},{15,-3,6,19,10},{0,12}},{{-3}}};
        //Integer[][][] test = new Integer[][][] {{{-5,13,16,16}},{{9},{10,11,-5}},{{20,20,2,-4,8},{-5,12,17,-5,5},{-2,-3},{}},{{2,10,-2,null},{11,18,2}},{{1,14},{-4,10}},{{-3,9,18}}}; 
        //Integer[][][] test = new Integer[][][] {{{2,-1,-2,16,4},{17,0,14,8,15,-4},{4,15,17,7},{13,20}},{{-5,14,-2,9,16,16},{}},{{null,14,3},{-3,4,13,-1},{-4,2,7,19,5,3}},{{-1,-5,4}}}; 
        //Integer[][][] test = new Integer[][][] {{{13,16},{17,0,9,20,18,16}},{{null,9}},{{-4,-4,-5,null,19}},{{},{6},{-1,-5,13,null}},{{20,2,10}},{{0,5},{20,13,null,null}},{{-5,18}}};
        //Integer[][][] test = new Integer[][][] {{{14,2,17},{-2},{12,-2,11},{17,4,-5,17,5,9}},{{null,15,12,1},{null,13,4},{10,1,null,10,3,14},{}}};
        //Integer[][][] test = new Integer[][][] {{{10,6},{8},{-3},{7,-4,14,-1,18}},{{7,null,14,16,-5},{16,20,6,17,-2,20}},{{-4,-4},{4,null,4,-4}},{{-4,17,-5,14,null},{-2,17},{17},{}}};
        //Integer[][][] test = new Integer[][][] {{{-4,6,9},{null,-4,13,3,15},{20,-5,9,null,1},{3,5,null,null,9,-1}},{{-5,3,8,null,2,13}},{{20,-4,18,17},{},{4,2,16},{8,7,6,11}},{{null}}};
        //Integer[][][] test = new Integer[][][] {{{10,3,-1,17,null,17},{9,1},{-4,-5,8,18,15,16}},{{-1,3,null,19,null},{-4,16,12,13,6,5},{15},{2,-5,null,9}},{{1,2,17,null,14},{-2,11}}}; 
        //Integer[][][] test = new Integer[][][] {{{0,5,0,-5},{20,4}},{{9,7,15,1,null,-4},{-1,-3,6,3},{},{20}},{{null},{12,7,null},{18,null,11,13},{11,11,4,null}}};
        //Integer[][][] test = new Integer[][][] {{{18},{15,-2,null},{4},{-3,16,20,14,13},{3,18,8,14,null}},{{20,null,19,6,8,3},{3,4},{4,14,-3,-2},{null,null}},{{9,13,10},{3,-3,12}}}; 
        //Integer[][][] test = new Integer[][][] {{{3,16},{null,4,10,0},{12,16,null},{}},{{0,null,7,10,2},{}}};
        //Integer[][][] test = new Integer[][][] {{{null,20,-2,null,5},{},{},{-5,19,5},{17}},{{19},{15,19,-1,1}},{{13,19,12,19}}};
        //Integer[][][] test = new Integer[][][] {{{9},{-4,20,18},{-4,0,null,20,19,-2},{-5,0,14,14},{14,16,10,0}},{{null,11},{3,3},{}},{{14,17,4,7,-4},{null,6,2,-5,-1},{-5,16,-4,null}}}; 
        //Integer[][][] test = new Integer[][][] {{{null,14,7},{18,10,17,20}},{{20,12},{5,15,null,15},{},{11,-3,19,18,18},{9,17,19}},{{},{10,-1,2,-5},{8,9,1,19}},{{5,13,17,5},{2,null}}}; 
        //Integer[][][] test = new Integer[][][] {{{6,null,2,5,2,0}},{{null,1,-3,12},{null,1,11,10,6},{12,-3,2,-3}},{{2,-3,null,-5,-5},{3,19,null},{4,15,15}},{{-1,19,15,-2}},{{null}}}; 
        //Integer[][][] test = new Integer[][][] {{{}},{{11},{7,18,7,2,15},{}},{{0,15,1,7},{-3,null,-3,2},{}},{{6,17,-1,null},{null,null}},{{13,18,4,17,6},{20},{17,14,3,14,-1},{17,1}}}; 
        //Integer[][][] test = new Integer[][][] {{{null,9,4,7},{1,null,8,15,7,17},{12,2,9}},{{8,6,16,-5,15},{-5,18}},{{null,10,14,12,1,13},{-5},{1,-5,13},{null,null,4,13,19}},{{20}}}; 
        //Integer[][][] test = new Integer[][][] {{{20,9,-4},{},{null},{2,10,-5,15,17}},{{-4,null},{},{5,12,18,1}}};
        //Integer[][][] test = new Integer[][][] {{{},{11,4,10,-1},{10,5},{1}},{{16,-4,-5},{12,11,7,-2,null,10},{11,6,0,6}},{{0,-3,17,null},{8,-3,12,7,-4},{15,2,16}},{{18},{9,null,1}}}; 
        //Integer[][][] test = new Integer[][][] {{{6,20,3,6,16},{1,-1,7,13}},{{13,5,null,17}},{{4,-4,1,8},{2,16,5,15,17},{5,-4}},{{-1},{-4,5,19,null,-2,-5},{},{11,null}},{{8,null}}}; 
        Integer[][][] test = new Integer[][][] {{{12,0,5,-1,-1,7}},{{18},{16}}};
        
        System.out.println("***********ENFORCES Resilience and Continuous Analysis***********");
        
        for (Integer [][] item: test)
        {
            matrix = new ArrayList<>();
            
            for (Integer [] row: item)
            {
                matrix.add(Arrays.asList(row));
            }
            testMatrix.add(matrix);
        }
        
        System.out.println("\n\n***FINAL OUTCOME***: \n" + matrixMultiplication(testMatrix));
    }
    
    public static List<List<Integer>> matrixMultiplication(List<List<List<Integer>>> matrices) 
    {
        List<Integer> rowInfo = new ArrayList<>();
                            
        int rowCounterNextMatrix;
        int seekPosition=0;        
        int numWritesAtIndexWithinMultiplicationMatrix;
        
        StringJoiner matrixRowCalculations = new StringJoiner("");
        StringJoiner excessRowItems=new StringJoiner(",");
        
        String rowMatrix=null;
        String currentEntry=null;
        String prevEntry=null;
        
        StringJoiner excessRowReport = new StringJoiner("\n");
        StringJoiner excessColReport = new StringJoiner("\n");
        StringJoiner [][] matrixMultiplicationCalculations=null;
        int numWritesToLastIndexOnRowMultiplicationMatrix;
        boolean hasReachedEndRow=false;
        boolean hasStartedMultiplication=false;
        Integer multiplication=0;
        
        int rowCounterFirstMatrix=0;
        int rowsNextMatrix=0;
        int matricesSize=matrices.size();
        
        int counter=0;
        
        int numElementsInRow=0;
        int posPrevMatrixRowLevel=0;
        int numMatrixes=0;
        
        //-------------------------------------------------------------------------------------------
        //This has been included to support 'resilience and continuous analysis'
        //We need to get longest row (most columns) to maximise calculations.
        //swapping references of nextMatrix.get(0).size() with maximumColumns
        int maximumColumns = 0;
         
        Integer [][]matrixMultiplication = null;
        
        List <List<Integer>> matrixMultiplicationList = new ArrayList<>();
        
        String currentColumnEntry;
        
        StringJoiner excessColItems=new StringJoiner(",");

        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
        {
            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("^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^");
            
            for (int j=0; j<nextMatrix.size();j++)
            {
                if (nextMatrix.get(j).size()>maximumColumns)
                {
                    maximumColumns=nextMatrix.get(j).size();
                }
            }
            //matrixMultiplicationCalculations=new StringJoiner[matrix.size()][nextMatrix.get(0).size()];
            matrixMultiplicationCalculations=new StringJoiner[matrix.size()][maximumColumns];
            
            System.out.println("Size of Matrix multiplication row: " + matrix.size());
            System.out.println("Size of Matrix multiplication columns: " + maximumColumns);
            
            System.out.println("*******Customising Storage Grid for Multiplication Matrix**********["+matrix.size()+"]["+maximumColumns+"]***************");
            
            for (int r=0; r<matrix.size(); r++)
            {
                for (int q=0; q<maximumColumns; q++)
                {
                    System.out.println("Configuring for index: " + r + "," + q);
                    matrixMultiplicationCalculations[r][q] = 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);
                
                numWritesToLastIndexOnRowMultiplicationMatrix=0;
                hasReachedEndRow=false;
                
                for (int k=0; k<ee.size(); k++)
                {
                    if(counter!=matricesSize-1)
                    {
                        rowCounterNextMatrix=0;
                        
                        if (!hasStartedMultiplication)
                        {
                            System.out.println("****************************CONFIGURING SIZE FOR BLANK MULTIPLICATION MATRIX*******************************************");
                            matrixMultiplication = new Integer[matrix.size()][maximumColumns];
                                
                            System.out.println("Multiplication matrix (W=" + matrix.size()+")  x  (H=" + maximumColumns+")" 
                            + " configured to store Matrix " + counter + " x  Matrix " + (counter+1));
                                
                            try
                            {
                                for (int a = 0; a < matrix.size(); a++) 
                                {
                                    for (int b = 0; b < maximumColumns; b++) 
                                    {
                                        matrixMultiplication[a][b] = 0;
                                    }
                                }
                            }
                    //--------------------------------------------------------------------------------            
                            catch (ArrayIndexOutOfBoundsException e)
                            {
                                System.out.println("\n33The current dimension of matrixMultiplication: " 
                                + "["+matrix.size()+"]"+ "["+maximumColumns+"]");
                            }
                            hasStartedMultiplication=true;
                        }
                        
                        if (maximumColumns==0)
                        {
                            System.out.println("8The current dimension of matrixMultiplication: " 
                            + "["+matrix.size()+"]"+"["+maximumColumns+"]");
                            System.out.println("2It EXPECTS: " + maximumColumns + " elements per row");
                            System.out.println("Hence multiplication matrix has no width");
                            System.out.println("matrix" + "("+(counter+1)+")" + " row:" + rowCounterNextMatrix +  " " 
                            + nextMatrix.get(0) + " size: " + nextMatrix.get(0).size());
                            System.out.println(matrices);
                            
                            //This has been included to support 'resilience and continuous analysis'
                            //System.exit(0);
                        }
                        
                        for (int z=0; z<maximumColumns; z++)
                        {
                            System.out.println("\n*****************Column number: " + z);
                            posPrevMatrixRowLevel=0;
                            numWritesAtIndexWithinMultiplicationMatrix=0;
                                         
                            for (int m=0; m<nextMatrix.size(); m++)
                            {
                                for (int j=0;j<nextMatrix.get(m).size();j++)
                                {
                                                
                                    if (numWritesAtIndexWithinMultiplicationMatrix==nextMatrix.size())
                                    {
                                        System.out.println("****************************************************************");
                                        break;
                                    }
                                    else
                                    {
                                        System.out.println("retrieving row: " + rowCounterNextMatrix 
                                        + " from matrix (" + (counter+1)+")");    
                                    }        
                                    rowInfo=new ArrayList<>(nextMatrix.get(m));
                                    
                                    if (!hasReachedEndRow)
                                    {
                                        seekPosition=0;
                                        excessRowItems = new StringJoiner(",");
                                        
                                        if (rowInfo.size()!=matrixMultiplication[0].length)
                                        {
                                            currentEntry = "2Row 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);
                                                
                                                //This has been included to support 'resilience and continuous analysis' for 'stress test cases'
                                                try
                                                {
                                                for (int x: nextMatrix.get(m))
                                                {
                                                    seekPosition++;
                                                                                                                            
                                                    if (seekPosition>matrixMultiplication[0].length)
                                                    {
                                                        excessRowItems.add(String.valueOf(x));
                                                    }
                                                }
                                                }
                                                catch (NullPointerException uu)
                                                {
                                                    
                                                }
                                            }
                                        }
                                        
                                        prevEntry = currentEntry;
                                        
                                        if (seekPosition!=0)
                                        {
                                            System.out.println("["+excessRowItems+"] are exempt from multiplcation matrix");
                                            excessRowReport.add("["+excessRowItems+"] are exempt from multiplcation matrix");
                                            
                                            if(excessRowItems.toString().length()==0)
                                            {
                                                System.out.println("10The current dimension of matrixMultiplication: " 
                                                + "["+matrix.size()+"]"+"["+maximumColumns+"]");
                                                System.out.println("3It EXPECTS: " + maximumColumns + " 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);
                                            }
                                        }
                                        try
                                        {
                                            System.out.println("Matrix["+(counter+1)+"] \trow element["+z+"]: " + rowInfo.get(z) +"\t\t" + nextMatrix.get(m));
                                                        
                                        }
                                        catch (IndexOutOfBoundsException e)
                                        {
                                            System.out.println("\n24The current dimension of matrixMultiplication: " 
                                            + "["+maximumColumns+"]"+"["+matrix.size()+"]");
                                            System.out.println("4It EXPECTS: " + maximumColumns + " 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);
                                        }
                                                    
                                        try
                                        {
                                            System.out.println("Matrix["+counter+"] \trow element["+posPrevMatrixRowLevel+"]: " +ee.get(posPrevMatrixRowLevel) +"\t\t" + ee);
                                        }
                                        catch (ArrayIndexOutOfBoundsException e)
                                        {
                                            System.out.println("\n1The 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()>matrixMultiplication.length)
                                            {
                                                System.out.println("--5It EXPECTS: " + matrix.size() + " elements per row");
                                                System.out.println("matrix" + "("+(counter)+")" + " row:" + rowCounterFirstMatrix 
                                                +  " " + matrix.get(rowCounterFirstMatrix) + " size: " 
                                                + matrix.get(rowCounterFirstMatrix).size() + " invalidates this");
                                            }
                                	    
                                            //I do not expect this statement to be correct now since we are now using maxColumns
                                            //it might be matrixMultiplication[0].length but necessarily the case.
                                            /*		
                                            if(nextMatrix.get(m).size()>matrixMultiplication[0].length)
                                            {
                                                System.out.println("--6It EXPECTS: " + matrix.size() + " elements per row");
                                                System.out.println("matrix" + "("+(counter+1)+")" 
                                                + " row:" + rowCounterNextMatrix +  " " + nextMatrix.get(m) + " size: " 
                                                + nextMatrix.get(m).size() + " invalidates this");
                                            }
                                            */
                                            
                                            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);
                                                
                                                //has been included to support 'resilience and continuous analysis'
                                                //System.exit(0);
                                            }
                                        }
                                                    
                                        try
                                        {
                                            multiplication =  ee.get(posPrevMatrixRowLevel) *rowInfo.get(z);
                                        }
                                        
                                        //This catch block has been included to support 'resilience and continuous analysis'
                                        catch (NullPointerException q)
                                        {
                                            multiplication=0;
                                        }
                                        
                                        catch (ArrayIndexOutOfBoundsException e)
                                        {
                                            //This try block has been included to support 'resilience and continuous analysis'
                                            try
                                            {
                                                System.out.println("2Matrix("+(counter)+")" + "   row:" + ee +"\thas no content at index["+m+"]");
                                                System.out.println("Hence can not perform multiplication with Matrix("+(counter+1)+")" + "   row:" + (rowCounterNextMatrix+1)+"\t" 
                                                +  "  index["+z+"]: " + rowInfo.get(z));
                                            
                                                //This has been included to support 'resilience and continuous analysis'
                                                multiplication =  0;
                                            
                                                //This has been included to support 'resilience and continuous analysis'
                                                //System.exit(0);
                                            }
                                            //This has been included to support 'resilience and continuous analysis'
                                            catch(IndexOutOfBoundsException w)
                                            {
                                                
                                            }
                                        }
                                        
                                        catch (IndexOutOfBoundsException e)
                                        {
                                            System.out.println("1Matrix("+(counter)+")" + "   row:" + rowCounterFirstMatrix+"\t" +  "value at index["+z+"]: " + ee.get(posPrevMatrixRowLevel) 
                                            +"  has no available supporting entry in \nMatrix("+(counter+1)+")" + "   row:" + (rowCounterNextMatrix+1)+"\t" +  "\t index["+z+"]: " + " row content:" + rowInfo);
                                            
                                            //This has been included to support 'resilience and continuous analysis'
                                            multiplication =  0;
                                            
                                            //This has been included to support 'resilience and continuous analysis' 
                                            //System.exit(0);
                                        }
                                                    
                                        try
                                        {
                                            //This has been included to support 'resilience and continuous analysis' 
                                            System.out.println(ee.get(posPrevMatrixRowLevel) + " X " + rowInfo.get(z) + "= " + multiplication);
                                            matrixMultiplication[rowCounterFirstMatrix][z] = matrixMultiplication[rowCounterFirstMatrix][z]  
                                            + multiplication;
                                        }
                                        
                                        catch (ArrayIndexOutOfBoundsException e)
                                        {
                                            System.out.println("\n2The current dimension of matrixMultiplication: " 
                                            + "["+matrix.size()+"]"+"["+maximumColumns+"]");
                                            System.out.println("1It EXPECTS: " + maximumColumns + " elements per row");
                                            
                                            System.out.println("matrix" + "("+(counter+1)+")" + " row:" + rowCounterNextMatrix +  " " 
                                            + nextMatrix.get(m) + " size: " + nextMatrix.get(m).size() + " invalidates this");
                                            
                                            //This has been included to support 'resilience and continuous analysis'
                                            try
                                            {
                                                System.out.println("2Matrix("+(counter)+")" + "   row:" + rowCounterFirstMatrix+"\t" 
                                                +  "value at index["+z+"]: " + ee.get(posPrevMatrixRowLevel) 
                                                +"  has no available supporting entry in \nMatrix("+(counter+1)+")" + "   row:" 
                                                + (rowCounterNextMatrix+1)+"\t" +  "\t index["+z+"]: " + " row content:" + nextMatrix.get(m+1));
                                            }
                                            catch (ArrayIndexOutOfBoundsException r)
                                            {
                                                
                                            }
                                            
                                            //This has been included to support 'resilience and continuous analysis'
                                            //System.exit(0);
                                        }
                                        //This has been included to support 'resilience and continuous analysis'
                                        //it supports this new entry in the try block
                                        catch (IndexOutOfBoundsException d)
                                        {
                                            
                                        }
                                        System.out.println("Value in multiplication matrix: " 
                                        + matrixMultiplication[rowCounterFirstMatrix][z] + "\t\t" 
                                        + "["+rowCounterFirstMatrix+"],["+z+"]" );
                                        numWritesAtIndexWithinMultiplicationMatrix++;
                                        
                                        
                                        //This try/catch block has been included to support 'resilience and continuous analysis'
                                        try
                                        {
                                            matrixMultiplicationCalculations[rowCounterFirstMatrix][z].add("(" + ee.get(posPrevMatrixRowLevel) 
                                            + "x" +rowInfo.get(z) +" ="+String.valueOf(multiplication)+")");
                                        }
                                        catch (IndexOutOfBoundsException g)
                                        {
                                            
                                        }
                                        
                                        System.out.println(matrixMultiplicationCalculations[rowCounterFirstMatrix][z]+"\n");
                                        
                                        if (z==(matrixMultiplication[0].length-1))
                                        {
                                            numWritesToLastIndexOnRowMultiplicationMatrix++;
                                            
                                            if (numWritesToLastIndexOnRowMultiplicationMatrix==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("---------------------------------------------------");
                                        
                                        j=nextMatrix.get(m).size();
                                        m=nextMatrix.size()-1;
                                    }
                                }
                                rowCounterNextMatrix=0;
                            }
                        }
                        System.out.println("Processed matrix("+(counter+1)+")  column("+k+")"+  " AGAINST " + "MATRIX("+counter+")  row("+rowCounterFirstMatrix+"): " + ee);
                    }
                    numElementsInRow++;
                }
                if(counter!=(matricesSize-1))
                {
                    for (List<Integer> rows: matrices.get((counter+1)))
                    {
                        rowsNextMatrix++;
                    }
                    if ((numElementsInRow!=rowsNextMatrix && numElementsInRow<matrices.get(counter+1).size()) || numElementsInRow==0)
                    {
                        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);
                        //This try block has been included to support 'resilience and continuous analysis'
                        //System.exit(0);
                    }
                    else
                    {
                        System.out.println("VERIFICATION SUCCESSFUL(MATRIX("+counter+")  row("+rowCounterFirstMatrix+")) =>  ***COLUMNS" + "("+numElementsInRow+")\t   Matrix("+(counter+1)+") =>  ***ROWS("+rowsNextMatrix+")");
                        
                        excessColItems = new StringJoiner(",");
                        
                        if (numElementsInRow>nextMatrix.size())
                        {
                            currentColumnEntry = "columns" + "("+numElementsInRow+") in Matrix"  + "("+counter+")" 
                        + "(Row:" +rowCounterFirstMatrix + " content: " +  rowMatrix +  ") inconsistent with " 
                        +  rowsNextMatrix + " rows in matrix("+(counter+1)+").";
                            
                            System.out.println(currentColumnEntry);
                           
                           //This try/catch block has been included to support 'resilience and continuous analysis'
                            try
                            {
                                for (int x: matrix.get(rowCounterFirstMatrix))
                                {
                                    seekPosition++;
                                            
                                    if (seekPosition>rowsNextMatrix)
                                    {
                                        excessColItems.add(String.valueOf(x));
                                    }
                                }
                            }
                            catch (NullPointerException l)
                            {
                                System.out.println("null value found in row");
                            }
                            
                            if (seekPosition!=0)
                            {
                                System.out.println("["+excessColItems+"] are exempt from multiplcation matrix");
                                
                                excessColReport.add(currentColumnEntry);
                                excessColReport.add("["+excessColItems+"] are exempt from multiplcation matrix"+"\n");
                            }
                            seekPosition=0;
                        }
                    }
                    rowsNextMatrix=0;
                }
                numElementsInRow=0;
                rowCounterFirstMatrix++;
            }
            rowCounterFirstMatrix=0;
                    
            counter=counter+2;
            rowsNextMatrix=0;
        
        }while (counter<matricesSize);
        
        System.out.println("\nMatrix Multiplication");
        //This try/catch block has been included to support 'resilience and continuous analysis'
        try
        {
            for (Integer []m: matrixMultiplication)
            {
                System.out.println(Arrays.toString(m));
            }
        }
        catch (NullPointerException w)
        {
            
        }
        
        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);
        }
        
        try
        {
            for (Integer []m: matrixMultiplication)
            {
                matrixMultiplicationList.add(Arrays.asList(m));
            }
        }
        catch (NullPointerException dd)
        {
            
        }
        
        System.out.println("\n-----MATRIX A   Analysis------");
        System.out.println(excessColReport);
        
        System.out.println("\n\n-----MATRIX B   Analysis------");
        System.out.println(excessRowReport);
        
        return matrixMultiplicationList;
    }
}