To get a list of intentions applicable to the code at the caret, just pressAlt+Enter.
1. Optimize statements and manage braces
Since the IDE is aware of the data flow in your code, it can help you optimize Boolean conditions and transform if/else statements:
With intentions you can, for example, automatically add and remove braces for your statements:
2. String concatenation
If you have String concatenation, the IDE can help you replace it with a String.format expression or a StringBuilder pattern.
3. Switch between loop declaration styles
With intentions you can also switch between loop declaration styles or even reverse its direction.
4. Math expressions
If you have a complicated math expression, the IDE will offer you to simplify an expression or possibly clarify it with parentheses.
5. Disable intention
If you don’t want to see a certain intention, you can disable it by selecting the right arrow on the intention.
The complete list of intentions (several hundred in total), grouped by language and framework, can be found inSettings→Intentions. Here you can enable/disable whole groups of intentions: