public AsciiBox alignBoxes(Collection<AsciiBox> boxes, int desiredWidth) {
        if (boxes.size() == 0) {
            return new AsciiBox(this, "");
        }
        int actualWidth = desiredWidth;
        for (AsciiBox box : boxes) {
            int boxWidth = box.width();
            if (boxWidth > actualWidth) {
                LOGGER.trace("Overflow by {} chars", boxWidth - desiredWidth);
                actualWidth = boxWidth;
            }
        }
        LOGGER.trace("Working with {} chars", actualWidth);
        AsciiBox bigBox = new AsciiBox(this, "");
        List<AsciiBox> currentBoxRow = new LinkedList<>();
        int currentRowLength = 0;
        for (AsciiBox box : boxes) {
            currentRowLength += box.width();
            if (currentRowLength > actualWidth) {
                AsciiBox mergedBoxes = mergeHorizontal(currentBoxRow);
                if (StringUtils.isBlank(bigBox.toString())) {
                    bigBox = mergedBoxes;
                } else {
                    bigBox = boxBelowBox(bigBox, mergedBoxes);
                }
                currentRowLength = box.width();
                currentBoxRow = new LinkedList<>();
            }
            currentBoxRow.add(box);
        }
        if (currentBoxRow.size() > 0) {
            // Special case where all boxes fit into one row
            AsciiBox mergedBoxes = mergeHorizontal(currentBoxRow);
            if (StringUtils.isBlank(bigBox.toString())) {
                bigBox = mergedBoxes;
            } else {
                bigBox = boxBelowBox(bigBox, mergedBoxes);
            }
        }
        return bigBox;
    }
AlignBoxes aligns all boxes to a desiredWidth and orders them from left to right and top to bottom (size will be at min the size of the biggest box)

@param boxes        to be aligned.
@param desiredWidth width desired
@return the aligned box.
plc4j/spi/src/main/java/org/apache/plc4x/java/spi/utils/ascii/AsciiBoxWriter.java