Use the formatter for this. Right click your file and select Source
-> Format
. You can also execute this for a single code block. Just select the block and right click -> Source
-> Format
. You can also format Javadoc this way.
If you don't like the way your code gets formatted you can change the formatter template in Windows
-> Preferences
-> Java
-> Code
-> Formatter
.