How to format a method in IntelliJ?
As soon as you click Ctrl+Alt+Shift+L in the current file editor, a dialog box appears. From the main menu, you can Click Code | Reformat Code or click Ctrl+Alt+L. After this, IntelliJ IDEA would look for reformating the source code automatically for the particular scope.
Learn more about IntelliJ format code: