Find more than one smallest submatrices in a big Matrix
<p>I have problem to find a number of the smallest submatrix m in a big matrix M and m=M/2; </p>

<p>I need to find the number of the submatrices in the same loops to find the smallest submatrix <br>
Here is what I have done.<br> </p>

<pre><code>public static void FindSmalSubMatrix(int mat3[][],int rows,int colums)
{
    int subm,i,j,temp=0,location1=0,location2=0, min=0;
    ArrayList submin = new ArrayList();
    if(rows&gt;=colums)
      subm=colums/2;
    else
      subm= rows/2;
    min= Firstmin(mat3,subm);

    for (i=0;i&lt;rows-subm+1;i++)
      for(j=0;j&lt;colums-subm+1;j++)
      {
          for(int k=i; k &lt;i+subm;k++)
              for (int l =j;l&lt;j+subm;l++)
              {

                 temp=temp+ mat3[k][l];
              }

           if (temp &lt;= min)
           {
               min=temp;
              submin.add(min);

              location1=i;
              location2=j;
           }

           temp=0;
      }
    System.out.println(min+" location is :"+location1+" "+location2);
    for( Object value:submin)
      System.out.print(value); 
}
</code></pre>

<p>And here is an Example <br></p>

<p>6 6 4 4 3<br>
2 2 3 3 8<br>
5 0 2 2 5<br>
4 9 2 1 4<br>
1 6 8 1 3<br>
7 location is :2 2 <br></p>

<p>161514977</p>

<p>but I need to print that 
min =7 
Location :1 1 <br>
2 3<br>
0 2<br></p>

<p>min =7 <br>
Location :2 2 <br>
2 2 <br>
1 2 <br></p>

<p>If anybody can help me I will be greatley appreciate it.</p>
