Here you can find the source of removeFirstNLines(String text, int n)
public static String removeFirstNLines(String text, int n)
//package com.java2s; //License from project: Open Source License import java.util.Scanner; public class Main { public static String removeFirstNLines(String text, int n) { Scanner scanner = new Scanner(text); int i = 0; while (scanner.hasNextLine() && i < n) { scanner.nextLine();//from w w w . ja v a 2 s . c o m i++; } String result = ""; while (scanner.hasNextLine()) { result += scanner.nextLine() + "\n"; } scanner.close(); return result; } }