title: How to skip first 3 rows of a text file?
body: <p>When I read the text file using Java, how can I skip first three rows of the text file?</p>
  
  <p>Current program,</p>
  
  <pre><code>public class Reader {
      public static void main(String[] args) {
          BufferedReader reader;
          try {
              reader = new BufferedReader(new InputStreamReader(
              new FileInputStream("sample.txt")));
              Map&lt;String, Integer&gt; result = new LinkedHashMap&lt;String, Integer&gt;();
              Map&lt;String, Integer&gt; result2 = new LinkedHashMap&lt;String, Integer&gt;();
              while (reader.ready()) {
                  String line = reader.readLine();
                  //split a line with spaces
                  String[] values = line.split("\s+");
                  //set a key date\tanimal
                  String key = values[0] + "\t" + values[1];
                  int sum = 0;
                  int count = 0;
                  //get a last counter and sum
                  if (result.containsKey(key)) {
                      sum = result.get(key);
                      count = result2.get(key);
                  } else{
  
                  }
                  //increment sum a count and save in the map with key
                  result.put(key, sum + Integer.parseInt(values[2]));
                  result2.put(key, count + 1);
              }
  
              //interate and print new output
              for (String key : result.keySet()) {
                  Integer sum = result.get(key);
                  Integer count = result2.get(key);
                  System.out.println(key + " " + sum + "\t" + count);
              }
              reader.close();
          } catch (FileNotFoundException e) {
  
              e.printStackTrace();
          } catch (IOException e) {
  
              e.printStackTrace();
          }
      }
  }
  </code></pre>