Retrieving the rows

As such I was given with a data that contains about 1,00,000 rows I couldn't able to read it ..how cud I be able 2 get 1st 1000 rows from the file , then 2nd 1000 rows and so on.. how could that be possible?
[222 byte] By [sarath44a] at [2007-11-27 8:48:34]
# 1
A loop that executes 1000 times or stops when it reaches the EOF.
floundera at 2007-7-12 20:55:54 > top of Java-index,Java Essentials,Java Programming...
# 2
by doing that way can I be able to get away from that OutOfMemoryError?
sarath44a at 2007-7-12 20:55:54 > top of Java-index,Java Essentials,Java Programming...
# 3
Depends. Do you need all 1 miilion rows in memory at once? Or can you read in 1000 rows process them and dump them from memory. If the former then I doubt it.
floundera at 2007-7-12 20:55:54 > top of Java-index,Java Essentials,Java Programming...
# 4
For my Program to work correctly, I need all values of all rows... so what can i do for that?
sarath44a at 2007-7-12 20:55:54 > top of Java-index,Java Essentials,Java Programming...
# 5
Why? Can you explain what you are trying to do and someone may be able to suggest a better way.
floundera at 2007-7-12 20:55:54 > top of Java-index,Java Essentials,Java Programming...
# 6

I'm trying to form clusters(ie; after reading the data from file which consists of numerical data ,the closely related numbers will be made as a cluster depending upon the some specification).The code that I made use of is given below

public void kohonen(int rows,int columns,double x[][])

{

double threshold=thresholdval;

double learningrate=lrateval;

//intializing weight array for clusters

double weight[][]=new double[rows+1][columns+1];

trackclusters=new double[rows+1][rows+1][columns+1];

//intializing array to hold the count of cluster points

clusterpointscount=new int[rows+1];

for(int i=1;i<=rows;i++)

{

clusterpointscount[i]=0;

}

//increasing the count of clusters to form first cluster

clusters++;

//assigning one point to the first cluster

clusterpointscount[clusters]=1;

for(int k=1;k<=columns;k++)

{

weight[1][k]=x[1][k];

trackclusters[1][1][k]=x[1][k];

}

System.out.println("rows "+rows+" columns "+columns);

System.out.println();

System.out.println();

//clusterpointscount[clusters]=1;

for(int m=1;m<=columns;m++)

{

System.out.print(x[1][m]+"");

}

System.out.println();

System.out.println("clusters "+clusters);

System.out.println();

double sum=0;

int z=1;

int l=0;

//array to have the euclidean distances

double Euclid[]=new double[rows];

double minimum=0.0;

//////////////////////////////////////////////////////////////////

////////////////////////////Clustering Begins/////////////////////

/////////////////////////////////////////////////////////////////

for(int i=2;i<=rows;i++)

{

z=1;l=0;

while((z<=clusters) && (l<1))

{

sum=0;

minimum=(double)(Math.pow(2,rows));

for(int j=1;j<=columns;j++)

{

sum=sum+(weight[z][j]-x[i][j])*(weight[z][j]-x[i][j]);

}

Euclid[z]=Math.sqrt(sum);

for(int v=1;v<=z;v++)

{

if(Euclid[v]<minimum)

{

minimum=Euclid[v];

}

}

if((( Math.sqrt(sum))>threshold) && (z==clusters) &&(minimum>threshold) )

{

l=1;

clusters++;

System.out.println("input");

for(int m=1;m<=columns;m++)

{

System.out.print(x[i][m]+"");

trackclusters[clusters][1][m]=x[i][m];

}

System.out.println();

System.out.println("clusters "+clusters);

System.out.println();

for(int m=1;m<=columns;m++)

{

weight[clusters][m]=x[i][m];

}

l=1;

}

z++;

}

minimum=(double)(Math.pow(2,rows));

for(int v=1;v<=clusters;v++)

{

if(( Euclid[v]<=threshold )&& ( Euclid[v]<minimum ) )

{

minimum=Euclid[v];

}

}

for(int v=1;v<=clusters;v++)

{

if(minimum==Euclid[v])

{

clusterpointscount[v]++;

for(int w=1;w<=columns;w++)

{

weight[v][w]=weight[v][w]+(learningrate*(x[i][w]-weight[v][w]));

trackclusters[v][clusterpointscount[v]][w]=x[i][w];

}

}

}

}

//System.out.println("weights");

//for(int i=1;i<=clusters;i++)

//{

//for(int j=1;j<=columns;j++)

//{

//System.out.print(weight[i][j]+" ");

//}

//System.out.println();

//}

///////////////////////////////////////////////////

/////printing out the tracked clusters/////////////

//////////////////////////////////////////////

for(int i=1;i<=clusters;i++)

{

System.out.println("Points in cluster"+i+":");

System.out.println();

for(int j=1;j<=clusterpointscount[i];j++)

{

for(int k=1;k<=columns;k++)

{

System.out.print(trackclusters[i][j][k]+" ");

}

System.out.println();

}

System.out.println();

}

writefiles(outfilename);

}

>

sarath44a at 2007-7-12 20:55:54 > top of Java-index,Java Essentials,Java Programming...