1: Set the comment template:
Download this template: codetemplates.xml
Search for Dangzhang, change it to your own name, save and open eclipse/myeclipse
Select window-->Preferences-->java-->Code-->Code Templates, click Import on the right, select the template .xml file you wrote and import it.
2: Set the formatted template:
Formatting template: eclipse-formatter.xml
The method for formatting templates is the same as above, except that instead of selecting Code Templates, select Formatter.
3: Automatically format code when saving:
Open eclipse/myeclipse
Select window-->Preferences-->JAVA-->Editor-->Save Actions
Select on the right: Perform the selected actions on save
Format source code
Format all lines
Organize imports
After saving, restart Myeclipse.