When formatting Strings with the Java String::format function, use %n rather than the newline escaped characters (\n). This will produced the platform specific new line during run time. With windows this will return a new line with a carriage feed (\r\n) and with everything else a standard new line (\n).

Also another thing to note about this: There is a rule for this in FindBugs. It is called:

FS: Format string should use %n rather than \n (VA_FORMAT_STRING_USES_NEWLINE)