Java tutorial
//package com.java2s; public class Main { private static final String SPACES = " "; private static void indent(final int i, StringBuffer b) { if (i > SPACES.length()) { b.append(SPACES); indent(i - SPACES.length(), b); } else { b.append(SPACES.substring(0, i)); } } }