private Point getMax(Point[] points) {
        double maxx = -Double.MAX_VALUE;
        for (int i = 0; i < points.length; i++) {
            if (points[i].x > maxx) {
                maxx = points[i].x;
            }
        }
        double maxy = -Double.MAX_VALUE;
        for (int i = 0; i < points.length; i++) {
            if (points[i].y > maxy) {
                maxy = points[i].y;
            }
        }
        return new Point(maxx, maxy);
    }