what\'s the best way to make main thread to wait until all threads are finished?
for(int i=0;i
I think for your requirement the best solution is the CyclicBarrier look at http://download.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/CyclicBarrier.html
or
at this example