I have an array of 3 rows and 4 columns. I need to compare every element of it with the others to find if it is repeated, how many times it repeats and the number of the row where they appear. I tried to use 4 for statements, and saving each one of these arguments in a class by making comparisons, but it doesn't work because every time I try to run the program this error appears java.lang.NullPointerException.

Thanks for your help in advance.