Here you can find the source of endsWithNewline(String string)
public static boolean endsWithNewline(String string)
//package com.java2s; //License from project: Open Source License public class Main { public static boolean endsWithNewline(String string) { if (string.isEmpty()) { return false; }/* w w w.jav a2 s. c o m*/ final char character = string.charAt(string.length() - 1); return character == '\r' || character == '\n'; } }