前2个for确定斜率
第3个for统计等于斜率的点数

import java.util.*;

/*
 * public class Point {
 *   int x;
 *   int y;
 * }
 */

public class Solution {
    /**
     * 
     * @param points Point类一维数组 
     * @return int整型
     */
    public int maxPoints (Point[] points){
        // write code here
        if(points == null|| points.length == 0){
            return 0;
        }
        if(points.length == 1 || points.length == 2){
            return points.length;
        }
        int res = 0;
        for(int i = 0 ; i < points.length - 1; ++i){
            int a = points[i].x;
            int b = points[i].y;
            for(int j = i + 1; j < points.length; ++j){
                int aa = points[j].x - a;
                int bb = points[j].y - b;
                int count = 0;
                if(aa == 0 && bb == 0){
                    for(int k = 0; k < points.length; ++k){
                        if(points[k].x == a && points[k].y == b){
                            count++;
                        }
                    }
                }else{
                    for(int k = 0; k < points.length; ++k){
                        if((points[k].x - a)*bb == (points[k].y - b) * aa){
                            count++;
                        }
                    }
                }
                res = Math.max(res, count);
            }
        }
        return res;
    }
}