• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Problem On Solving Tricks - Double for loop

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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

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 :'(.

Please help.
Thanks in advance.

John.
 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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;
}
}

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic