title: Finding repeats in a 2D array
body: <p>I have made a program that outputs the number of repeats in a 2D array. The problem is that it outputs the same number twice.</p>
  
  <p>For example: I input the numbers in the 2D array through Scanner: 10 10 9 28 29 9 1 28.
  The output I get is:</p>
  
  <pre><code>Number 10 repeats 2 times.
  Number 10 repeats 2 times.
  Number 9  repeats 2 times.
  Number 28 repeats 2 times.
  Number 29 repeats 1 times.
  Number 9  repeats 2 times.
  Number 1  repeats 1 times.
  Number 28 repeats 2 times.
  </code></pre>
  
  <p>I want it so it skips the number if it has already found the number of repeats for it. The output should be:</p>
  
  <pre><code>Number 10 repeats 2 times.
  Number 9  repeats 2 times.
  Number 28 repeats 2 times.
  Number 29 repeats 1 times.
  Number 1  repeats 1 times.
  </code></pre>
  
  <p>Here is my code: </p>
  
  <pre><code>import java.util.Scanner;
  
  public class Repeat
  {
      static Scanner leopard = new Scanner(System.in);
  
      public static void main(String [] args)
      {
          final int ROW = 10;                     //Row size
          final int COL = 10;                     //Column size
          int [][] num = new int[ROW][COL];
  
          int size;
  
          //Get input
          size = getData(num);
  
          //Find repeat
          findRepeats(num, size);
      }
  
      public static int getData(int [][] num)
      {
          int input = 0, actualSize = 0;      //Hold input and actualSize of array
  
          System.out.print("Enter positive integers (-999 to stop): ");
  
          //Ask for input
          for(int i = 0; i &lt; num.length &amp;&amp; input != -999; i++)
          {
              for(int j = 0; j &lt; num[i].length &amp;&amp; input != -999; j++)
              {
                  input = leopard.nextInt();
  
                  //Check if end
                  if(input != -999)
                  {
                      num[i][j] = input;
                      actualSize++;
                  }
              }
          }
  
          System.out.println();
  
          return actualSize;
      }
  
      public static void findRepeats(int [][] num, int size)
      {
          int findNum;
          int total = 0, row = 0, col = 0;
  
          for(int x = 0; x &lt; size; x++)
          {
              //Set to number
              findNum = num[row][col];
  
              //Loop through whole array to find repeats
              for(int i = 0; i &lt; num.length; i++)
              {
                  for(int j = 0; j &lt; num[i].length; j++)
                  {
                      if(num[i][j] == findNum)
                          total++;
                  }
              }
  
              //Cycle array to set next number
              if(col &lt; num[0].length-1)
                  col++;
              else
              {
                  row++;      //Go to next row if no more columns
                  col = 0;    //Reset column number
              }
  
              //Display total repeats
              System.out.println("Number " + findNum + " appears " + total + " times.");
              total = 0;
          }
      }
  }
  </code></pre>
  
  <p>I know why it is doing it, but I cannot figure out how to check if the number has already been checked for it to skip that number and go to the next number. I cannot use any classes or code that is not used in the code.</p>