This is a combination of all the answers above that suits me -
- Go to
Preferences > Java > Code Style > Formatter and set all the necessary parameters, creating your own profile or using the standard one. Personally, I think that linear transfer is limited to 80 too low. I set it to 200. - Save the "user" settings by specifying a new profile name (export it for further recovery)
- Select the code in your editor, then press
CTRL+SHIFT+F This should format your code.
Designed miracles for me every time.
source share