int (@NotNull CharSequence chars, final boolean skipLastEmptyLine) { int lineCount = 0; if (chars.length() != 0) { final LineTokenizer tokenizer = new LineTokenizer(chars); while (!tokenizer.atEnd()) { lineCount += 1; tokenizer.advance(); } if (!skipLastEmptyLine && stringEndsWithSeparator(tokenizer)) { lineCount += 1; } } return lineCount; }