I generate .java files from a PrintWriter class. These generated files contain many nested for loops. To properly indent everything, I am currently using something like:
for(int j = 0; j < i + 2; j++)
{
pw.print(" ");
}
pw.println("{");
Just to properly indent the single parentheses.
Obviously, I could just make a method to do this. I'm more wondering if there's a library that will handle indention and such of outputted code.