static BufferedImage gridLOLToImage(LL lol, L cellWidths, L cellHeights) { L> lom = mapWithIndex(lol, (i, m) -> listToMatrix(cellWidths.get(i), m)); MatrixOfMatrices mom = listToMatrix_cols(cols, lom); BufferedImage restored = newBufferedImage(image.getWidth(), image.getHeight()); L cellX1s = partialSums_firstIs0(cellWidths); L cellY1s = partialSums_firstIs0(cellHeights); forEachWithPosition(mom, (x, y, cell) -> drawIntMatrix(restored, cell, cellX1s.get(x), cellY1s.get(y))); ret restored; }