astyle

Source code indenter, formatter, and beautifier for the C, C++, C# and Java programming languages. Upon running, a copy of the original file is created with an ".orig" appended to the original file name. More information: http://astyle.sourceforge.net.

astyle source_file

astyle --style=java path/to/file

astyle --style=allman path/to/file

astyle --indent=spaces=number_of_spaces path/to/file

astyle --indent=tab=number_of_tabs path/to/file