How to use Java Formatter
- Paste the Java code.
- Select the indent.
- Copy the result.
About Java Formatter
Snippets copied from a forum, a PDF or a chat lose their indentation sooner or later. This tool re-indents Java by its braces, starts a new line after every statement and leaves string literals and comments alone.
It is a layout fixer for snippets, not a replacement for google-java-format or your IDE, which also reorder imports and wrap long lines.