// Find the minimal page size that fits all rects.
BinarySearch widthSearch = new BinarySearch(minWidth, settings.maxWidth, settings.fast ? 25 : 15, settings.pot);
BinarySearch heightSearch = new BinarySearch(minHeight, settings.maxHeight, settings.fast ? 25 : 15, settings.pot);
int width = widthSearch.reset(), height = heightSearch.reset(), i = 0;
Page bestResult = null;
while (true) {
Page bestWidthResult = null;
while (width != -1) {
Page result = packAtSize(true, width - edgePaddingX, height - edgePaddingY, inputRects);
if (++i % 70 == 0) System.out.println();
System.out.print(".");
bestWidthResult = getBest(bestWidthResult, result);
width = widthSearch.next(result == null);
}