Use Tools | Reformat Code... to reformat code according to your code style preferences (see Options | IDE Settings | Code Style).

You may also automatically "optimize" imports (remove unused imports, etc) according to the settings (see Options | IDE Settings | Code Style | Imports) using Tools | Optimize Imports....