title: Input in an array with no dimension without array list
body: <p>I want to create a program that reads int values from the user until a value that is not an int is introduced. Then i want to get how many numbers are equal.
  I tried this code</p>
  
  <pre><code>import java.util.Scanner;
  
  public class Equals {
      public static void main(String[] args){
          Scanner keyboard = new Scanner(System.in);
          Scanner input = keyboard;
          int index = 0;
          int equals = 0;
          while(keyboard.hasNextInt()){
              keyboard.nextInt();
              index++;
          }
          int[] equals = new int[index];
          for(int i = 0 ; i &lt; index ; i++){
              int aux = input.nextInt();
              values[i] = aux;
              for(int b = 0 ; b &lt; index ; b++){
                  if(aux == values[b]){
                      equals++;
                  }
              }
          }
          System.out.print(equals);
      }
  }
  </code></pre>
  
  <p>This code doesnt work because the keyboard scanner only gets the number of values introduced by the user and i use that for the array size but i cant get each individual value to compare. I cant use array lists.</p>