Here you can find the source of indentNextLines(String text, String indent)
protected static String indentNextLines(String text, String indent)
//package com.java2s; //License from project: Open Source License public class Main { protected static String indentNextLines(String text, String indent) { String origText = new String(text); String ret = new String(); String[] lines = text.split("\\n"); for (int i = 0; i < lines.length; i++) { // last line and no final \n on orig text if (i == lines.length - 1 && !origText.endsWith("\n")) ret += indent + lines[i]; else/*from www . ja v a 2s . co m*/ ret += indent + lines[i] + "\n"; } return ret; } }