I have a csv.file with 80 lines and 4 columns that represents one specific Movie Store.
- 1st column: idSale
 - 2nd column: Movie
 - 3rd column: Genre
 - 4td column: Director
 
The file has a header with the names above and the rest of lines are the content. There are 79 sales, 30 movies, 10 directors and 8 genres. In the file one movie as only one genre and one director.
The movies, the genres and the directors are repeated... only the id is a non-repeated value.
I've managed to put the csv file into an array2D by counting the number of lines and columns. The array 2D is called movieCinema.
I've already managed a way to store each column into an array with non-repatead values because one of the tasks was to print the movies, the directors and the genres.
I've 3 arrays with repeated values with the following names:
- movies
 - directors
 - genres
 
The length of this arrays is equal to the number of lines in the array2D-1 (because I didn't store the header).
And I've 3 arrays with non-repeated values)
- moviesUnique (length equals 30)
 - directors (length equals 10)
 - genres (length equals 8)
 
Now, the last task is to print the movies by genre of the director Christopher Nolan. Example:
Christopher Nolan
Genre: Action
- Movie 1
 - Movie 5
 
Genre: Drama
- Movie 2
 
Genre: Sy-fy
- Movie 3
 - Movie 4
 
I can't do this. I'm able to print all the movies of Chistopher Nolan and all the genres of him as well, but I can't put his the movies by genre.
This is my function to search:
public static String[] search (String[][] matrix, String searchItem, int searchCol, int indexCol) {
    int arraySize = 0;
    int index = 0;
    String[] items;
    // Compares each line (skip the header) that is equals to the max value and increases arraySize
    for (int i=1; i<matrix.length; i++) {
        if (searchItem.equals(matrix[i][searchCol])){
            arraySize++;
        }
    }
    // Declare array
    items = new String[arraySize];
    // Store all lines that has correspondence to the searchItem
    for (int i=1; i<matrix.length; i++){
        if (searchItem.equals(matrix[i][searchCol])){
            items[index] = matrix[i][indexCol];
            index++;
        }
    }
    return items;
}
Then I have a function to store only the unique values of an array called uniqueValues, that is working perfectly.
/**
 * Function that removes the duplicates of an array and stores only the unique valus
 * @param array
 * @return
 */
public static String[] uniqueValues (String[] array) {
    boolean duplicate;
    int index=0;
    int arraySize = 0;
    for (int i=1; i<array.length; i++) {
        duplicate = false;
        for (int j=i+1; j<array.length; j++) {
            if (array[i].equals(array[j]) && duplicate == false) {
                duplicate = true;
            }
        }
        if (duplicate == false) {
            arraySize++;
        }
    }
    String[] arrayUnique = new String[arraySize];
    for (int i=1; i<array.length; i++) {
        duplicate = false;
        for (int j=i+1; j<array.length; j++) {
            if (array[i].equals(array[j]) && duplicate == false) {
                duplicate = true;
            }
        }
        if (duplicate == false) {
            arrayUnique[index] = array[i];
            index++;
        }
    }
    return arrayUnique;
}
So in the main I call the functions:
String director = "Chistopher Nolan"
// This has movies and genres repeated
String[] directorGenresRepeated = search(movieCinema, director, 4, 3);
String[] diretorMoviesRepeated = Library.search(store, director, 4, 2);
// This has movies and genres non-repeated
String[] directorGenres = Library.uniqueValues(directorGenresRepeated);
String[] directorMovies = Library.uniqueValues(directorMoviesRepeated);
So if I print this array with a for I get all the movies of Chistopher Nolan and I get all the genres movies of Chistopher Nolan... It print this:
- Genre 1
 - Genre 2
 - Genre 3
 
And then the movies:
- Movie 1
 - Movie 2
 - Movie 3
 - Movie 4
 - Movie 5
 
But the point is to have:
Genre: Action
- Movie 1
 - Movie 5
 
Genre: Drama
- Movie 2
 
Genre: Sy-fy
- Movie 3
 - Movie 4
 
How can I do this?? I can't use lists or sets... or hashmaps... I can only use arrays, 2 arrays, for loops, while loops..
Could you help me?