It should be
r.append("\n"); But I recommend you to do as below,
r.append(System.getProperty("line.separator")); System.getProperty("line.separator") gives you platform independentsystem-dependent newline in java. Also from Java 7 there's a method that returns the value directly: System.lineSeparator()