title: Java read k lines of n integers
body: <p>I have an input (the console input, not from file). First line contains 3 integers: a,b,c . Then the next a+c lines contain 2 integers delimited by whitespace. E.G:</p>
  
  <pre><code>3 2 4
  91 94
  92 97
  97 99
  92 94
  93 97
  95 96
  90 100
  </code></pre>
  
  <p>I have to read the first 3 numbers, then (in this case) 3+4 lines of 2 integers. How Can I read the input correctly? I am sending the file to online compiler (Codeforces.com if it matters)</p>
  
  <p>Here is my code(I try to read the file partially but it works not as intended):</p>
  
  <pre><code>//reads the first 3 numbers
      public static int[] readInit(){
      Scanner sc = new Scanner(System.in);
      int[] integers = new int[3];
      for(int i = 0; i &lt;=2; i++)
      {
          integers[i] = sc.nextInt();
      }
      return integers;
  }
  
  //reads the next 3 lines
  public static int[] read(){
      Scanner sc = new Scanner(System.in);
      int[] integers = new int[2];
      for(int i = 0; i &lt;=1; i++)
      {
          integers[i] = sc.nextInt();
      }
      return integers;
  }
  
  public static void main(String[] args) {
      int[] initData = readInit();
      nrOfRecipes = initData[0];
      minNrRecommended = initData[1];
      nrOfQuestions = initData[2];
  
      for (int i=0; i&lt;nrOfRecipes; i++){
          int[] data = read();
          minDegrees = data[0];
          maxDegrees = data[1];
          ...
      }
      ...
  </code></pre>
  
  <p>but this code reads only the first 3 integers from the first line. How can I read the data correctly? Thank you!</p>