here is the oprogram for reading entries fro a file and making all possible combinations for the entries of those files each file contains 20,000
entries the first while loop runs for all 20,000 entries but the inner runs foor only one entry
package combinator;
import java.io.*;
import Reader.HandsFileReader;
public class FinalCombination{
HandsFileReader hfr=new HandsFileReader();
BufferedReader b1,b2,s;
String bs1,bs2, ss;
final String separator =System.getProperty("line.separator");
public void finalRead(){
try{
FileWriter fr=new FileWriter("F:/java/Project/outputfiles/FinalCombination.txt");
b1=hfr.readSingle();
b2=hfr.readSingle();
s=hfr.readSamyukta();
while((bs2=b1.readLine())!=null){
while((bs1=b2.readLine())!=null){
String temp=(bs1+","+bs2);
char []c=temp.toCharArray();
for(int i=0;i<c.length;i++){
fr.append(c[i]);
}
fr.append(separator);
}
while((ss=s.readLine())!=null){
String temp=(ss+","+ss);
char []c=temp.toCharArray();
for(int i=0;i<c.length;i++){
fr.append(c[i]);
}
fr.append(separator);
}
fr.close();
}
}
catch(IOException e){
e.printStackTrace();
}
System.out.println("Done");
}
public static void main(String[] args) {
FinalCombination fc=new FinalCombination();
fc.finalRead();
}
}
The Underlined second loop is executing only once while thw outer loop executes untill the end of the file
here is the sample of the input file
an,0,0,0,0,0,0
swa,0,0,0,0,0,0
dol,0,0,0,0,0,0
pus,0,0,0,0,0,0
katv,0,0,0,0,0,0
an,0,0,0,0,90,0
swa,0,0,0,0,90,0
dol,0,0,0,0,90,0
pus,0,0,0,0,90,0
katv,0,0,0,0,90,0
an,0,0,0,0,180,0
swa,0,0,0,0,180,0
dol,0,0,0,0,180,0
pus,0,0,0,0,180,0
katv,0,0,0,0,180,0
an,0,0,0,90,0,0
swa,0,0,0,90,0,0
total 20,000 input both the file and i want their all possible combinations
and the output i want is like this all possible combination of two files with 20,000 string entries
an,0,0,0,0,0,0swa,0,0,0,0,0,0
dol,0,0,0,0,0,0pus,0,0,0,0,0,0
katv,0,0,0,0,0,0an,0,0,0,0,90,0
swa,0,0,0,0,90,0dol,0,0,0,0,90,0
pus,0,0,0,0,90,0katv,0,0,0,0,90,0
an,0,0,0,0,180,0swa,0,0,0,0,180,0
dol,0,0,0,0,180,0pus,0,0,0,0,180,0
katv,0,0,0,0,180,0an,0,0,0,90,0,0
please suggest if dere is any other possible way to get such a huge combination