Often we spend time reformatting or working on badly formatted code. That's not worth spending time on - something that can be automated by the IDE.
Just use Cmd + Alt + L to Auto-reformat Code Properly. This video shows a badly formatted code and undoes the changes with Cmd + Z to comparatively just show how the reformatting improved the code.