I have this professor that wants us to make a using the method header 
 Public static int[] eliminateDuplicates(int[] arr)
The program uses a randomly generated array to see if there are duplications but the user gives a limit on how many indexes's the random array has. Here is what I have but it's not working.

```
import java.util.Random;
import java.util.Scanner;
public class Dublicates
{
    public static void main(String[] args)
    {
        Scanner input = new Scanner(System.in);
        Random generator = new Random();

        System.out.println("Enter array length: ");
        int[] a = new int[input.nextInt()];

        for (int i = 0; i<a.length; i++)
        {
            a[i] = generator.nextInt(a.length*2);
        }
        int[] result = eliminateDuplicates(a);
        System.out.println("The new numbers are: " + result.length);
        System.out.println("The double numbers were:");
        for (int b : result)
        {
            System.out.println(b + " ");
        }
    }
    public static int[] eliminateDuplicates(int[] arr)
    {
        int[] temp = new int[arr.length];
        int size = 0;
        for (int i = 0; i < arr.length; i++) {
            if (linearSearch(temp, arr[i]) == -1) {
                temp[size] = arr[i];
                size++;
            }
            int[] result = new int[size];
            for (int i = 0; i < size; i++) {
                result[i] = temp[i];
            }
            {
                return result;

            }
        }
    }
    public static int linearSearch(int[] arr, int key)
    {
        for(int i = 0; i<arr.length; i++)
        {
            if (key == arr[i])
                return i;
        }
        return -1;
    }
}

```