We will divide the work of computing the maximum of all values in an array over multiple threads. Each thread will compute the maximum of a subrange and then update a shared max variable and a shared count of completed threads.
When all threads have completed their work, then the main thread is ready to return the result. Your task is to provide an efficient mechanism for finding out when the work is complete. You should use a condition object and call the await method, thereby deactivating the main thread until one of the subsidiary threads has updated the completion count.
Be sure to use the lock when you check whether the completion count has reached the total number of threads.
You will need to deal with the InterruptedException. It is ok to simply return 0 if it is caught.