I am trying to find duplicate words in a string array.
Here is my code for the comparison:
for ( int j = 0 ; j < wordCount ; j++)
{
Here i see you are trying to find unique elements count for given string. I would suggest using HashSet for better solution.
public int getUniqueElements(String str)
{
HashSet hSet = new HashSet<>();
// iterate given string, hSet only adds unique elements to hashset
for(int i = 0; i < str.length() ; i++
hSet.add(str.charAt(i));
return hSet.size();
}