title: Pulling distinct values from a array in java
body: <p>Have a program where the user inputs 10 int values into the array. Lastly I need to pull out the distinct values and display them. Added my second for loop which would determine if the the value is distinct (i.e. meaning if the number appears multiple times it is only displayed once).</p>
  
  <p>For instance, let say I pass in the numbers: 1, 2, 3, 2, 1, 6, 3, 4, 5, 2 the distinct array should only contain numbers {1, 2, 3, 6, 4, 5}</p>
  
  <pre><code>import java.util.Scanner;
  import java.io.*;
  
  public class ArrayDistinct {
   public static void main(String[] args) throws IOException {
  
   Scanner input = new Scanner(System.in);
  
   // Create arrays &amp; variables  
   int arrayLength = 10;
   int[] numbers = new int[arrayLength];
   int[] distinctArray = new int[arrayLength];
   int count = 0;
  
   System.out.println("Program starting...");
   System.out.print("Please enter in " + numbers.length + " numbers: ");
  
   for (int i = 0; i &lt; numbers.length; i++) {
    numbers[i] = input.nextInt();
   }
  
   for (int i = 0; i &lt; numbers.length; i++) {
    int temp = numbers[i];
    int tempTwo = numbers[i + 1];
  
    if (tempTwo == temp) {
     count++;
     distinctArray[i] = temp;
    }
   } 
  
   // Print out results
  
  } // end main
  } // end class
  </code></pre>