class GeometryTools {

    public static double[] getMinMax(IAtomContainer container) {
        double maxX = -Double.MAX_VALUE;
        double maxY = -Double.MAX_VALUE;
        double minX = Double.MAX_VALUE;
        double minY = Double.MAX_VALUE;
        for (int i = 0; i < container.getAtomCount(); i++) {
            IAtom atom = container.getAtom(i);
            if (atom.getPoint2d() != null) {
                if (atom.getPoint2d().x > maxX) {
                    maxX = atom.getPoint2d().x;
                }
                if (atom.getPoint2d().x < minX) {
                    minX = atom.getPoint2d().x;
                }
                if (atom.getPoint2d().y > maxY) {
                    maxY = atom.getPoint2d().y;
                }
                if (atom.getPoint2d().y < minY) {
                    minY = atom.getPoint2d().y;
                }
            }
        }
        double[] minmax = new double[4];
        minmax[0] = minX;
        minmax[1] = minY;
        minmax[2] = maxX;
        minmax[3] = maxY;
        return minmax;
    }

}