Here you can find the source of indent(String in)
public static String indent(String in)
//package com.java2s; public class Main { public static String indent(String in) { StringBuilder sb = new StringBuilder(in); sb.insert(0, " "); for (int i = 0; i < sb.length(); i++) { char c = sb.charAt(i); if (c == '\n') { sb.insert(i + 1, " "); }/*from w w w. j a v a2 s . c o m*/ } return sb.toString(); } }