I want to count Words with several Threads and every thread has a "wordCount" variable. Now how can i wait till every thread is finished? At the end i should count every variable of each thread together and print it out?
How i create my Threads:
for (int i = 1; i <= THREADS_TO_USE; i++) {
long bytesToRead = splitManager();
new Thread(new CountWordsThread(file, bytesToRead, bytesCounted)).start();
}