private static Dimension adaptTileDimensions ( final Dimension pixels , final int maxWidth , final int maxHeight ) { return new Dimension ( adaptTileDimension ( pixels . width , maxWidth ) , adaptTileDimension ( pixels . height , maxHeight ) ) ; }
Adapt the size of the tiles so that we have the same amount of tiles as we would have had with maxWidth and maxHeight but with the smallest tiles as possible .