Except Mac it use the below commad.
Press: Ctrl + Shift + F
⌘ + ⇧ + F
Or, in the main menu > Source > Format
U can follow this also,
Another option is to go to Window->Preferences->Java->Editor->SaveActions and check the Format source code option. Then your source code will be formatted truly automatically each time you save it.