<prompt> Kujenga kazi katika Java ambayo inachukua safu ya integer na kuangalia kama ina duplicates.  <response>: Heres an example of a Java function that takes an array of integers as input and returns a boolean value indicating whether it contains any duplicates or not:public boolean containsDuplicatesint nums Set set new HashSet; forint n : nums ifset.containsn return true; set.addn; return false;In this function, we use a Set data structure to keep track of the numbers encountered in the array. We iterate through the given array of integers one by one, and for each integer, we first check if it is already present in the Set. If it is, then it means the array contains duplicates and we return true. Otherwise, we add the integer to the Set and move to the next integer. If no duplicates are found after iteration is complete, we return false.This solution has a time complexity of On since we are processing each integer in the array exactly once. 