public static void trimIndentation(String[] lines, int tabWidth, boolean considerFirstLine) { String[] toDo= new String[lines.length];  int minIndent= Integer.MAX_VALUE; for (int i= considerFirstLine ? 0 : 1; i < lines.length; i++) { String line= lines[i]; if (containsOnlyWhitespaces(line)) continue; toDo[i]= line; int indent= computeIndent(line, tabWidth); if (indent < minIndent) { minIndent= indent; } }  if (minIndent > 0) {  for (int i= considerFirstLine ? 0 : 1; i < toDo.length; i++) { String s= toDo[i]; if (s != null) lines[i]= trimIndent(s, minIndent, tabWidth); else { String line= lines[i]; int indent= computeIndent(line, tabWidth); if (indent > minIndent) lines[i]= trimIndent(line, minIndent, tabWidth); else lines[i]= trimLeadingTabsAndSpaces(line); } } }
public static void trimIndentation(String[] lines, int tabWidth) { trimIndentation(lines, tabWidth, true);
	public static void trimIndentation(String[] lines, int tabWidth, boolean considerFirstLine) {		String[] toDo= new String[lines.length];		// find indentation common to all lines		int minIndent= Integer.MAX_VALUE; // very large		for (int i= considerFirstLine ? 0 : 1; i < lines.length; i++) {			String line= lines[i];			if (containsOnlyWhitespaces(line))				continue;			toDo[i]= line;			int indent= computeIndent(line, tabWidth);			if (indent < minIndent) {				minIndent= indent;			}		}				if (minIndent > 0) {			// remove this indent from all lines			for (int i= considerFirstLine ? 0 : 1; i < toDo.length; i++) {				String s= toDo[i];				if (s != null)					lines[i]= trimIndent(s, minIndent, tabWidth);				else {					String line= lines[i];					int indent= computeIndent(line, tabWidth);					if (indent > minIndent)						lines[i]= trimIndent(line, minIndent, tabWidth);					else						lines[i]= trimLeadingTabsAndSpaces(line);				}			}		}	}