Follow these steps to implement the example:
- Create a class named ArrayGenerator. This class will generate an array of random integer numbers with the specified size. Implement a method named generateArray(). It will generate the array of numbers. It receives the size of the array as a parameter:
public class ArrayGenerator { public int[] generateArray(int size) { int array[]=new int[size]; Random random=new Random(); for (int i=0; i<size; i++){ array[i]=random.nextInt(10); } return array; }
- Create a class named TaskManager. We will use this class to store all the tasks executed in ForkJoinPool used in the example. Due to the limitations of the ForkJoinPool and ForkJoinTask classes, you will use this class to ...