title: Check to see if any duplicate index values exist within an array?
body: <p>So basically, I have one array, with ten values...</p>
  
  <pre><code>int[] input = new int[10];
  </code></pre>
  
  <p>The user controls the input to each value.</p>
  
  <p>What would be a good technique to check to see if any of the values inside of the array are equal to any of the other values?</p>
  
  <p>Edit:</p>
  
  <pre><code>public static void main(String[] args) {
      P2 numbers = new P2();
  
      for (int i = 0; i &lt; numbers.input.length; i++) {
          numbers.input[i] = numbers.scan.nextInt();
      }
      numbers.Check();
      if (numbers.Check()) { System.out.println("Duplicate"); }
      if (numbers.Check() == false) { System.out.println("NOT Duplicate"); }
  }
  
  public boolean Check() {
          int length = input.length;
          for(int i : input) {
              for(int j = i + 1; j &lt; length; j++) {
                  if(input[i] == input[j]) return true;
              }
          }
          return false;
      }
  </code></pre>
  
  <p>The codes works ask long as duplicate numbers are index-neighbors.</p>