Write a method to eliminate the duplicate values in the array using the following method header:

public static int[] eliminateDuplicate(int[] numbers)

Write a test program that reads in ten integers, invokes the method, and displays the result. Here is the sample run of the program:

Here is my code:Enter ten numbers: 1 2 3 2 1 6 3 4 5 2

The distinct numbers are: 1 2 3 6 4 5

import java.util.*; public class EliminatingDuplicates { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter ten numbers: "); int[] numbers = new int[10]; for(int i = 0; i < numbers.length; i++) { int num = input.nextInt(); } System.out.println("The distinct numbers are: "); eliminateDuplicates(numbers); } public static void eliminateDuplicates(int[] numbers) { for(int i = 0; i < numbers.length; i++) { boolean distinct = true; for(int j = 0; j < i; j++) { if (numbers[i] == numbers[j]) { distinct = false; break; } if (distinct) System.out.println(numbers[i]); } } } }

My code compiles. However when I run the program, no distinct numbers show up. This is my output.

What am I doing wrong??Enter ten numbers: 1 2 3 2 1 6 3 4 5 2

The distinct numbers are: