1
line.replaceAll("\\s+$", "");