Formatting in Netbeans will not delete all the blank lines and sometimes we want this. For example, when the charset is messed up and the blank spaces are doubled because CR and LF – Unix – Windows compatibility.
Solution: Ctrl-F (find) in Netbeans as Regular Expression:
and Replace All by
A special thanks to http://seo.911web.org/netbeans-how-to-delete-blank-lines