title: Your code did not execute within the time limits in Hackerrank
body: <p>I have coded for maximum  no of integers that array contains.I am using <code>temp</code> as a counter for counting the integers and using two variables <code>largestIndex</code> for pointing the index and <code>largest</code> for storing the largest temp. Below is code of that   </p>
  
  <pre><code>import java.io.*;
  import java.math.*;
  import java.security.*;
  import java.text.*;
  import java.util.*;
  import java.util.concurrent.*;
  import java.util.function.*;
  import java.util.regex.*;
  import java.util.stream.*;
  import static java.util.stream.Collectors.joining;
  import static java.util.stream.Collectors.toList;
  
  public class Solution {
  
      // Complete the migratoryBirds function below.
      static int migratoryBirds(List&lt;Integer&gt; arr) {
      int largest = 0;
      int largestIndex=-1;
      for(int i=0;i&lt;arr.size();i++)
          {
          int temp=0;
          for(int j=0;j&lt;arr.size();j++)
              {
              if(arr.get(i)==arr.get(j) &amp;&amp; i!=j)
                  {
                  temp++;
                  }
              }
           if(temp&gt;largest)
              {
                  largest = temp;
                  largestIndex=i;
              }
          }
              return arr.get(largestIndex);
      }
  
      public static void main(String[] args) throws IOException {
          BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
          BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));
  
          int arrCount = Integer.parseInt(bufferedReader.readLine().trim());
  
          List&lt;Integer&gt; arr = Stream.of(bufferedReader.readLine().replaceAll("\\s+$", "").split(" "))
              .map(Integer::parseInt)
              .collect(toList());
  
          int result = migratoryBirds(arr);
  
          bufferedWriter.write(String.valueOf(result));
          bufferedWriter.newLine();
  
          bufferedReader.close();
          bufferedWriter.close();
      }
  }
  </code></pre>