Matcher trailingSpaceMatcher = TRAILING_SPACE.matcher(line); if (trailingSpaceMatcher.find()) { handleError("Trailing space found", linecount, trailingSpaceMatcher.start(), trailingSpaceMatcher.end()); line = trailingSpaceMatcher.replaceAll(""); String element = line.substring(31, Math.min(34, line.length())).trim(); if (line.length() < 34) { handleError("Element atom type does not follow V2000 format type should of length three" + " and padded with space if required", linecount, 31, 34); handleError("Mass difference is missing", linecount, 34, 36); handleError("Atom charge count is empty", linecount, 35, 39);