public static void main(String args[]){
        int input[][] = {{1,2,3},
                         {4,5,6},
                         {7,8,9}};
        
        MatrixFindAllSubSquareRectangleMatrix mal = new MatrixFindAllSubSquareRectangleMatrix();
        mal.printSumOfAllRectangleMatrix(input);
    }
Iterate through matrix and get all subsquare and subrectangle matrix and print their sum
src/com/interview/multiarray/MatrixFindAllSubSquareRectangleMatrix.java