To import codestyle:
- Go to settings
- Editor/Code Style/Java
- Next to "Scheme" select the configuration icon
- Choose "Import Scheme" and select "IntelliJ IDEA code style XML"
- Choose the
idea-code-style.xmlfile
Now when reformatting, choose to also optimize imports and rearrange code.