# Guys can you please help me to find what's wrong with this code ?

• public class Solution {
public List<Integer> spiralOrder(int[][] matrix) {
List<Integer> numbers = new ArrayList<Integer>();

``````    int StartCol =0;
int EndCol =0;
int EndRow = 0;
if (matrix.length > 0)
{
EndRow = matrix.length-1;

}
else
{
return numbers;
}
int StartRow = 0;
if(matrix[0].length>0)
{
EndCol = matrix[0].length-1;

}
else
{
return numbers;
}
//  printLayer(matrix, 0, EndRow, 0, EndCol);
while ( StartCol < EndCol || StartRow < EndRow )
{
for (int x : printLayer(matrix, StartRow, EndRow, StartCol, EndCol))
{
}
StartCol++;
StartRow++;
EndCol--;
EndRow--;

}
return numbers;
}

public List<Integer> printLayer(int[][] matrix , int StartRow , int EndRow , int StartCol , int EndCol)
{
``````

List<Integer> numbers = new ArrayList<Integer>();
//i for columns and j for rows
int i =StartCol;
int j = StartRow;
//////////////////////////////////////
if (StartRow == EndRow && StartCol < EndCol) // 1 row ,, many columns
{
while (i <= EndCol)
{
i++;
}

``````        }
else if (StartCol == EndCol && StartRow < EndRow)
{
while (j <= EndRow)
{
j++;
}

}

/////////////////////////////////////
else
{
while (i <= EndCol) // Start Row fixed
{
i++;
}
j=StartRow+1;

while (j <= EndRow) // End Col fixed
{
j++;
}
i=EndCol-1;
while (i >= StartCol) //End Row fixed
{
i--;
}
j= EndRow-1;
while (j > StartRow) // Start Col fixed
{