Try to use google-java-formatter to format source code in the java application.
I have snippet codes need to be formatted (not in a class, or in a function, just mult