# Problem On Solving Tricks - Double for loop

John A.C
Greenhorn
Posts: 1

Hi guys, lets make this as a piece of challenge.
Reading from file "cache.txt" will result the same Sring[] result.

Well, the most challenging part is :
I wanted to sort tht array, in a manner of 5 arrays per row.
Eg :

Row [0] 0193240000,0193240001,0193240002,0193240000,0193240001
Row [1] 0193240002
p/s : this is only for 6 arrays.. if multiple array like it contains of 27 data's it should be looking like
Row [0] 0193240000,0193240001,0193240002,0193240000,0193240001
Row [1] 0193240000,0193240001,0193240002,0193240000,0193240001
Row [2] 0193240000,0193240001,0193240002,0193240000,0193240001
Row [3] 0193240000,0193240001,0193240002,0193240000,0193240001
Row [4] 0193240000,0193240001,0193240002,0193240000,0193240001
Row [5] 0193240000,0193240001

The reson of this is, i need to concatenate each data, rebuild the string into a row / line, so that can be inserted into mysql. For the insert code, i have done tht.

Ah, one more thing,on the 27th array [if referring to the codes above] it'll pops up an error. Wanted to off tht too.

Just the matter now.. now to program the 2 x for loops. Been thinking tht for days :'(.

John.

Vasu Reddy
Ranch Hand
Posts: 32
Hi replace the for loop with this;

for (int y = 0; y < g ; y=y+5) {

int counter = 0;
for (int z = y ; z <g ; z++) {
counter = counter +1;
System.out.println(" : "+y+" : "+result[z]);

if(counter == 5)
break;
}
}