HOw to Assign Rowindex Values to An Array

Hi,
I am Trying to store Rowindex into an array.

Code:

if(cell.getStyle().getColor().isAuto())
{

}
else{
int ages[] = new int[4];
ages[m]=cell.getRowIndex()+1;
System.out.println(ages[m]);
m=m+1;
}

please help me out. Thanks in Advance.

Hi,

You are doing it right, just place int ages[] = new int[4]; in outerscope. Your code should look like this

e.g


int ages[]=new int[4];
int m=0;

if(cell.getStyle().getColor().isAuto())
{

}
else
{
ages[m]=cell.getRowIndex()+1;

System.out.println(ages[m]);

m=m+1;
}