public double getBoundingBoxZoom(final BoundingBox pBoundingBox, final int pScreenWidth, final int pScreenHeight) {
        final double longitudeZoom = getLongitudeZoom(pBoundingBox.getLonEast(), pBoundingBox.getLonWest(), pScreenWidth);
        final double latitudeZoom = getLatitudeZoom(pBoundingBox.getLatNorth(), pBoundingBox.getLatSouth(), pScreenHeight);
        if (longitudeZoom == Double.MIN_VALUE) {
            return latitudeZoom;
        }
        if (latitudeZoom == Double.MIN_VALUE) {
            return longitudeZoom;
        }
        return Math.min(latitudeZoom, longitudeZoom);
    }
@Test
    public void testGetBoundingBoxZoom() {
        final int tileSize = 256;
        final int screenWidth = tileSize * 2;
        final int screenHeight = screenWidth * 2;
        TileSystem.setTileSize(tileSize);

        final int iterations = 2000;
        for (int i = 0; i < iterations; i++) {
            final double north = getRandomLatitude();
            final double south = getRandomLatitude();
            final double east = getRandomLongitude();
            final double west = getRandomLongitude();
            final BoundingBox boundingBox = new BoundingBox(north, east, south, west);
            final double zoom = tileSystem.getBoundingBoxZoom(boundingBox, screenWidth, screenHeight);
            if (zoom == Double.MIN_VALUE) {
                Assert.assertTrue(north <= south || east == west);
                continue;
            }
            final double mapSize = TileSystem.MapSize(zoom);
            final long left = tileSystem.getMercatorXFromLongitude(west, mapSize, true);
            final long top = tileSystem.getMercatorYFromLatitude(north, mapSize, true);
            final long right = tileSystem.getMercatorXFromLongitude(east, mapSize, true);
            final long bottom = tileSystem.getMercatorYFromLatitude(south, mapSize, true);
            long width = right - left;
            if (east < west) {
                width += mapSize;
            }
            final long height = bottom - top;
            checkSize(width, height, screenWidth, screenHeight);
        }
    }