private Point selection(List<Point> points, int index, int type) {
        List<Integer> list = new ArrayList<Integer>();
        for (Point p : points) {
            if (type == 0) {
                list.add(p.x);
            } else {
                list.add(p.y);
            }
        }
        int value = Selection.select(list, index);
        Point point = null;
        for (Point p : points) {
            if (type == 0) {
                if (p.x == value) {
                    point = p;
                    break;
                }
            } else {
                if (p.y == value) {
                    point = p;
                    break;
                }
            }
        }
        return point;
    }