this is my test data :
{5,1,3,6,1},
{4,1,3,3,2},
{6,2,1,4,1},
{5,1,4,1,3},
{4,2,1,5,2}

i want it to be output like this : 5,4,1,6,1,3,5,2,3,6,4,1,1,3,1,2,4,4,2,1,…

this is my coding :

public int[] linear45(int[][] A){

int[] l = new int[A.length * A[0].length];

for(int i=0; i <3; i++)
{
for(int j= 0; j <= i; j++)
{
l[j+(i*A[0].length)] =A[i-j][j];
}

}
return l;
}

Does your code produce what you want? If not post its output and explain what you'd like to change.

Can you explain your algorithm for generating the output from the input? I don't see any pattern for getting the output from the input.

Could you make a small self contained program that executes with data for input and that displays the output for testing your algorithm.