public static String join(String[] lines, String glue) {
        if (lines.length == 1) {
            return lines[0];
        }
        StringBuilder out = new StringBuilder();
        for (int i = 0; i < lines.length - 1; i++) {
            out.append(lines[i]).append(glue);
        }
        out.append(lines[lines.length - 1]);
        return out.toString();
    }