Follow these steps to implement the example:
- Create a class named Task that extends the RecursiveAction class:
public class Task extends RecursiveAction{
- Declare a private int array attribute named array to store the array of elements you want to increment:
private final int array[];
- Declare two private int attributes named start and end to store the start and end positions of the block of elements this task has to process:
private final int start; private final int end;
- Implement the constructor of the class to initialize its attributes:
public Task (int array[], int start, int end) { this.array=array; this.start=start; this.end=end; }
- Implement the compute() method with the main logic of the task. If ...