public int maxPoints(Point[] points) {
        // k -> point
        if (points == null)
            return 0;
        if (points.length <= 1)
            return points.length;
        int ans = 0;
        for (int i = 0; i < points.length; ++i) {
            HashMap<Double, Integer> map = new HashMap<Double, Integer>();
            int same = 0;
            int vertical = 1;
            for (int j = i + 1; j < points.length; ++j) {
                if (points[i].x == points[j].x && points[i].y == points[j].y) {
                    same += 1;
                } else if (points[i].x == points[j].x) {
                    vertical += 1;
                } else {
                    double slope = getK(points[i], points[j]);
                    if (map.containsKey(slope)) {
                        map.put(slope, map.get(slope) + 1);
                    } else {
                        map.put(slope, 2);
                    }
                }
            }
            int localMax = 0;
            for (int max : map.values()) {
                localMax = Math.max(localMax, max);
            }
            localMax = Math.max(localMax, vertical);
            localMax += same;
            ans = Math.max(ans, localMax);
        }
        return ans;
    }