1. Reformat code
IntelliJ IDEA automatically applies code style you've configured as you edit, and in most cases you don’t need to call Reformat Code action explicitly. However, you can do so anytime either for current file, selected piece of code, or even an entire directory by simply pressing Alt + Ctrl + L (Alt + Cmd + L for Mac.)
When you want to apply Reformat Code to an entire directory, use the same shortcut in the Project Tool Window.
2. Auto-indent lines
Another useful action is Auto-Indent Lines, which helps you to fix line indentation. This action sometimes is a better option than Reformat Code, because it does not require you to select anything. Just press Alt + Ctrl + I (Alt + Cmd + I for Mac), and it will quickly fix indents for the current line.
IntelliJ IDEA lets you configure code style settings for each of the supported languages either at project or IDE level via Settings → Code Style.
When you choose Project scheme in settings, you can share your code style with other team members via version control.
4. Tab character
Last, but not least of the settings worth your attention is Use tab character. By default this setting is off and IntelliJ IDEA uses regular spaces for indents instead of tabs. If you have files with lots of indents, you may want to optimize their size by selecting this option.