Use Code | Reformat Code to reformat code according to the code style defined on the (Editor | Code Style) settings/preferences page.

You can also use Code | Optimize Imports to automatically optimize imports (remove unused imports, etc.). You can access the corresponding settings on the Editor | General | Auto Import settings/preferences page.