static String valueToString(Tensor tensor, boolean shortForms, long maxCells) {
        var cellEntries = new ArrayList<>(tensor.cells().entrySet());
        cellEntries.sort(Map.Entry.comparingByKey());
        if (tensor.type().dimensions().isEmpty()) {
            if (cellEntries.isEmpty()) return "{}";
            return "{" + cellEntries.get(0).getValue() +"}";
        }
        StringBuilder b = new StringBuilder("{");
        int i = 0;
        for (; i < cellEntries.size() && i < maxCells; i++) {
            if (i > 0)
                b.append(", ");
            b.append(cellToString(cellEntries.get(i), tensor.type(), shortForms));
        }
        if (i == maxCells && i < tensor.size())
            b.append(", ...");
        b.append("}");
        return b.toString();
    }
Call this from toString in implementations to return this tensor on the
<a href="https://docs.vespa.ai/en/reference/tensor.html#tensor-literal-form">tensor literal form</a>.
(toString cannot be a default method because default methods cannot override super methods).

@param tensor the tensor to return the standard string format of
@param withType whether the type should be prepended to the content
@param maxCells the max number of cells to output, after which just , "..." is output to represent the rest
                of the cells
@return the tensor on the standard string format
vespajlib/src/main/java/com/yahoo/tensor/Tensor.java