Eclipse has a good code formatting feature. You can use the Crtl+Shift+F keyboard
shortcut or the context menu to reformat a Java source file. The formating options
are available in Window>Preference>Java>Code Style>Code Formatter.
Sometimes you might change a code formatting option and want to reformat all the java
source files. Eclipse has an easy way of doing this. Just right click on the project
in Project Explorer and click the Format menu item under Source.
You also bring up the source menu directly by pressing Alt+Shift+S.