/*find if the array has duplicate by using brute force*/
public boolean bruteforce(String[] arr) {
  for (int i = 0; i < arr.length; i++) {
    for (int j = 0; j < arr.length; j++) {
      if (arr[i].equals(arr[j]) && i != j)
        return true;
    }
  }
  return false;
}

/*It will return true if the array has duplicates*/
public boolean hasDuplicates(String[] input){
  List inputList = Arrays.asList(input);
  Set inputSet = new HashSet(inputList);
  if(inputSet.size()< inputList.size())
    return true;
   return false;
}

/*This method will return the suplicate value(if present),
else a blank string.*/
public String checkDuplicateUsingAdd(String[] input) {
  Set inputSet = new HashSet();
  for (String str : input) {
    if (!inputSet.add(str)) 
      return str;
  }
  return "";
}