We will divide the work of computing the sum of all values in an array over multiple threads. Each thread will compute the sum of a subrange and then update a shared sum variable and a shared count of completed threads.
The RangeProcessor class, which implements the Runnable interface, encapsulates the processing of a range sum.
You will start ten threads, each with its own RangeProcessor. You will then need to wait for each thread to terminate. This is achieved by calling the join method of the Thread class.
Thread t = new Thread(...); t.start(); t.join(); // will continue when t has finished
You can simply join each of the ten threads in order since you need all their values before you can continue. Once all threads have terminated, call the getSum methods on the RangeProcessor objects to compute the total sum and then the average.
You will need to deal with the InterruptedException. It is ok to simply return 0 if it is caught.