Hey guys im very new to java and am having some difficulty solveing a problem for my class. I have an array of 10 numbers and have to write a method that will eliminate any duplicates in the array and return that array. Iv been toying with different thing for a while and still cant get anything to work. Any help in the right direction would be very appreciated. Thank you
import java.util.*;
class Lab8b
{
public static void main(String[] args) {
Scanner joe = new Scanner(System.in);
int[] numbers = new int[10];
System.out.println("Enter 10 numbers");
numbers[0] = joe.nextInt();
numbers[1] = joe.nextInt();
numbers[2] = joe.nextInt();
numbers[3] = joe.nextInt();
numbers[4] = joe.nextInt();
numbers[5] = joe.nextInt();
numbers[6] = joe.nextInt();
numbers[7] = joe.nextInt();
numbers[8] = joe.nextInt();
numbers[9] = joe.nextInt();
}
public static int[] eliminateDuplicates(int[] numbers){
Arrays.sort(numbers);
int left = 0;
int right = numbers.length - 1;
while( left < right ) {
int temp = numbers[left];
numbers[left] = numbers[right];
numbers[right] = temp;
left++;
right--;
}}
return ;
}