Android Studio change package name

Sometime it is needed to change the package of the project.
Below is the easy way which worked for me in android studio.

1. Open your project in android studio
2.Click the setting icon at top right corner of project menu.
3. Uncheck "Compact Empty Middle Package".

4.Right Click the folder that need to be changed.
5. Go to "Refactor->Rename"
6.Click rename package.
7. Enter package name and click Refactor.
8.Now at bottom Find Refracting preview click do refactor.
9. Now the folder name must have changed.
10.Now open "build.gradle" file for your module and change the "applicationID".
11. You are done now , Click sync to build the project.