Imprimir números inteiros distintos em uma matriz

Estou tentando escrever um pequeno programa que imprime números distintos em uma matriz. Por exemplo, se um usuário digitar 1,1,3,5,7,4,3, o programa imprimirá apenas 1,3,5,7,

Estou recebendo um erro no else if linha na funçãocheckDuplicate.

Aqui está o meu código até agora:

import javax.swing.JOptionPane;

public static void main(String[] args) {
    int[] array = new int[10];
    for (int i=0; i<array.length;i++) {
        array[i] = Integer.parseInt(JOptionPane.showInputDialog("Please enter"
                                  + "an integer:"));
    }
    checkDuplicate (array);
}

public static int checkDuplicate(int array []) {
    for (int i = 0; i < array.length; i++) {
        boolean found = false;
        for (int j = 0; j < i; j++)
            if (array[i] == array[j]) {
                found = true;
                break;
            }
        if (!found)
            System.out.println(array[i]);
    }
    return 1;
}
}

questionAnswers(8)

yourAnswerToTheQuestion