For our first assignment in our algorithm class we are suppose to solve several different questions using information from a 2D array. We are also suppose to optimize our code to get more marks on our assignment. We also are only allowed to use 1D and 2D arrays as the only data structure.The problem was find the unique values in a 2D array (int data[][]) of 1000x250 values. The range of that is from 2000000 to 2200000. My idea was to make a 1D array (with 200000 indexes) and look at the number in the 2D array and see it matches anything prior to it in the 1D array, and if not, add it. However, with all the other questions, it takes a few seconds before it will actually finish.int[] uniqueValues = new int[200000];    boolean isUnique = true;    int uniqueCounter = 0;     for (int i = 0; i < data.length; i++) {         for (int j = 0; j < data[i].length; j++) {            for (int x = 0; x < uniqueCounter; x++) {                if (data[i][j] != uniqueValues[x]) {                    isUnique = true;                } else {                    isUnique = false;                    break;                }            }            if (isUnique) {                uniqueValues[uniqueCounter] = data[i][j];                uniqueCounter++;            }        }}
Unique value finder
java;performance;algorithm;array;memory optimization