Here you can find the source of chop(String line)
public static String chop(String line)
//package com.java2s; public class Main { public static String chop(String line) { if (line.endsWith("\r\n")) { return line.substring(0, line.length() - 2); }//from w w w.j av a 2 s .c om if (line.endsWith("\n")) { return line.substring(0, line.length() - 1); } if (line.endsWith("\r")) { return line.substring(0, line.length() - 1); } return line; } }