Follow these steps to implement the example:
- Start the example by implementing two auxiliary classes. First, create a class named MatrixMock. This class will generate a random matrix of numbers between one and 10, where the threads will look for a number:
public class MatrixMock {
- Declare a private int matrix named data:
private final int data[][];
- Implement the constructor of the class. This constructor will receive the number of rows of the matrix, the length of each row, and the number we are going to look for as parameters. All the three parameters are of the type int:
public MatrixMock(int size, int length, int number){
- Initialize the variables and objects used in the constructor:
int counter=0; data=new ...