public static double getMinimumZoom(final Graph2DView view) {
    double zoomlevel = view.getZoom();

    if (zoomlevel < 0) {
      zoomlevel = 1;
    }

    final Point2D viewPoint = view.getViewPoint2D();
    final Rectangle2D box = view.getGraph2D().getBoundingBox();
    view.zoomToArea(box.getX(), box.getY(), box.getWidth(), box.getHeight()); // why? => to gain the
    // minimum zoom level
    // in the next line
    final double minZoom = view.getZoom();
    view.setZoom(zoomlevel); // why? => to reset the original zoom level after the minimum zoom
    // level was calculated
    view.setViewPoint2D(viewPoint.getX(), viewPoint.getY()); // why? => to reset the original view
    // point
    return minZoom - (minZoom / 2);
  }
Calculates the smallest valid zoom level.

@return The smallest valid zoom level.
java/zylib/src/main/java/com/google/security/zynamics/zylib/yfileswrap/gui/zygraph/helpers/ZoomHelpers.java