title: Run 100 threads in parallel and run missing threads if some previous are finished
body: <p>For example I need to always run 100 threads to do some action.
  I have class which called <code>ThreadsWorker</code> which looks for threads count and runs missing threads if some previous are finished.
  So, this is the table which describes situation:</p>
  
  <pre><code>1 second: 100 threads
  2 second: 92 threads (ThreadsWorker generates new 8 threads)
  3 second: 100 theads
  4 second: 72 threads (ThreadsWorker generates 28 threads)
  </code></pre>
  
  <p>And so on.
  My threads are anonymous calls (just <code>new Thread(new Runnable(...)).start()</code>) because I don't know how to correctly save them to <code>Threads[]</code> array because, while <code>ThreadsWorker</code> will save <code>threads[i] = new Threads()</code>, some threads may be finished and then there will be some collision with array indexes.</p>
  
  <p>Because of anonymous calls I use <code>threadsCount</code> variable now and increment it in threads body beginning and decrements in threads body end (using <code>synchronized</code>). Okay, it works correctly and my single way is to use <code>while()</code> loop which checks if <code>threadsCount == 0</code> when the progress is complete.</p>
  
  <p><strong>I think that this is C-style but not Java-way :) So, can you help me to do it in Java-way?</strong></p>