The NetBeans IDE
has a great shortcut for reformatting sourcecode. Simply hit ⌃⇧F (ctrl shift f), and all the sourcecode in the current file will be reformatted. This is a great feature, and I only stumbled upon it through a StackOverflow search
Before reformatting. This is how the code looked on StackOverflow
After running the algorithm. Note how much more readable it is
(Sourcecode taken from this stackoverflow post)
The other time it’s useful is when working on a project where someone is using very large tab settings (e.g. 8 spaces per tab instead of 4). This can make it very difficult to read. By invoking this command, you’ll put the code into a much more readable format.