title: Can I simplify this using recursion?
body: <p>Not sure If i can simplify the two for loops as they are similar? Any help appreciated. Can I use recursion?</p>
  
  <pre><code>public static Integer Search(int array[])
  {   
      //Loop through original array 
      for(int compare : array)
      {
          int count = 0;
  
          //Will loop through array and compare each integer to compare
          for(int currentInt : array)
          {
              //Comparing currentInt to compare
              if (currentInt == compare)
                  count += 1;
  
              //If the currentInt is in the array twice
              if (count == 2)
                  return currentInt;
          }
      }
      return null;
  }
  </code></pre>