Why turns the string to empty?

If I run this code the first 28 lines of the append.txt are full of numbers but then it is empty, why? It should also contains some numbers!!

Is the String get too big?

try {

OutputStream os = new FileOutputStream(new File("append.txt"), true);

String seq = "11", output = "";

int u = 1;

while(u<=37)

{

String temp = "";

int iter = 1;

for(int i=0; i
if(seq.charAt(i)==seq.charAt(i+1)) {

iter++;

if(i==seq.length()-2) {

temp += iter + "" + seq.charAt(i);

iter=1;

}

}else {

temp += iter + "" + seq.charAt(i);

if(i==seq.length()-2) {

temp += "1" + seq.charAt(i+1);

}

iter=1;

}

}

seq=temp;

output += seq + "\n";

System.out.println(u + ": " + seq.length());

u++;

}

os.write(output.getBytes(), 0,...

Read More »

By: StackOverFlow - 5 days ago

Related Posts