Checking an array for duplicate values
I suggest you use a Set when checking for duplicates:

Set&lt;Integer&gt; set = new HashSet&lt;&gt;();

for(int i : selectedWordIds) {
    if(!set.add(i)) {
        repeatedTime++;
    }
}


This is much simpler that what you have.

Here:


 if(repeatedTime &gt; 1)
 {
     notDuplicate = false;
     RandomizeFunction(selectedWordIds, answersTempId);
 }



The assignment notDuplicate = false is not necessary because notDuplicate is already false.

About recursion: It is possible. With it, here is the final code:

private void CheckForDuplicates(int[] selectedWordIds,
        List&lt;Integer&gt; answersTempId) {

    int repeatedTime = 0;

    Set&lt;Integer&gt; set = new HashSet&lt;&gt;();

    for(int i : selectedWordIds) {
        if(!set.add(i)) {
            repeatedTime++;
        }
    }
    if (repeatedTime &gt; 1) {
        RandomizeFunction(selectedWordIds, answersTempId);
        CheckForDuplicates(selectedWordIds, answersTempId);
    }

}