int (String @NotNull [] lines, boolean preserveContent, boolean ignoreLastLine) { int prefix = Integer.MAX_VALUE; for (int i = 0; i < lines.length && prefix != 0; i++) { String line = lines[i]; int indent = 0; while (indent < line.length() && Character.isWhitespace(line.charAt(indent))) indent++; if (indent == line.length() && (i < lines.length - 1 || ignoreLastLine)) { if (!preserveContent) lines[i] = ""; } else if (indent < prefix) prefix = indent; } return prefix; }