How to apply Google Java Code style in Android Studio?

In order to add Google Java Code style:

1. Go to Preferences -> Editor -> Code style -> Java
2. Download the style
3. Go to Manage -> Select ‘Intellij IDEA code style XML’ -> OK -> Select downloaded style file -> OK -> Select ‘GoogleStyle’ -> OK -> Close -> Apply

From now your code will be formatted according to Google Java code style.