public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("<table border=\"").append(border).append("\" cellSpacing=\"").append(cellSpacing).append("\">\n");
        int columnCount = getColumnCount();
        for (Row row : cells) {
            sb.append("<tr>\n");
            for (int i=0; i<row.cells.size(); ++i) {
                Cell cell = row.cells.get(i);
                CellProperties properties = new CellProperties();
                properties.add(tableProperties);
                if (colProperties.size() > i) {
                    properties.add(colProperties.get(i));
                }
                properties.add(row.rowProperties);
                properties.add(cell.properties);

                sb.append(row.isHeaderRow ? "<th" : "<td");
                if (properties.backgroundColor != null) {
                    sb.append(" bgcolor=\"#").append(getColor(properties.backgroundColor)).append('"');
                }
                if (properties.contentAlignment != null) {
                    sb.append(" align=\"").append(properties.contentAlignment.name().toLowerCase()).append('"');
                }
                if (properties.colSpan != null) {
                    int colSpan = properties.colSpan;
                    if (colSpan == 0) colSpan = (columnCount - i);
                    sb.append(" colspan=\"").append(colSpan).append('"');
                }
                if (properties.rowSpan != null) {
                    sb.append(" rowspan=\"").append(properties.rowSpan).append('"');
                }
                sb.append(">");
                if (properties.allowLineBreaks != null && !properties.allowLineBreaks) sb.append("<nobr>");
                sb.append(cell.content);
                if (properties.allowLineBreaks != null && !properties.allowLineBreaks) sb.append("</nobr>");
                sb.append(row.isHeaderRow ? "</th>" : "</td>").append("\n");
            }
            sb.append("</tr>\n");
        }
        sb.append("</table>\n");
        return sb.toString();
    }
Helper class in order to write HTML tables
clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/status/statuspage/HtmlTable.java