## Problem with printing out collinear lines!

Ok, I'm trying to make a program that takes in a random assortment of points from 0 to 32,767 (for x and y) and it finds any series of 4 or more points which are collinear.

So far my program does exactly that with ONE problem. I first order the array by x values and then traverse through each point using that as a "pivot" point and taking the angle from all the other points to the right of it. I then order these angles so that I can go through an array of angles and pick out all the lines with the same angle (which means all points of these angles are on the same line).

Now this all works great, but the problem is I can't filter out subsets. i.e. if my input is (0,0) (100,100) (200,200) (300,300) and (400,400), I get the output:

(0, 0) (100, 100) (200, 200) (300, 300) (400, 400)
AND
(100, 100) (200, 200) (300, 300) (400, 400)

I can't figure out how to filter out subsets. Here's my main code (all outside classes are properly implemented and just order my arrays and find angles).

```import java.util.Arrays;
import java.util.Comparator;

public class Fast{
public static void main (String[] args){
// rescale coordinates and turn on animation mode
StdDraw.setXscale(0, 32768);
StdDraw.setYscale(0, 32768);
StdDraw.show(0);

Point[] p = new Point[N];
Angle[] angle;
Comparator<Angle> comp = new MyComparator();
Comparator<Point> pcomp = new ArrayOrder();

for (int i = 0; i < N; i++) {
p[i] = new Point(x, y);
p[i].draw();
}

Arrays.sort(p, pcomp);

// display to screen
StdDraw.show(0);

for (int i=0; i<p.length-1; i++){
angle = new Angle[p.length-i-1];
angle = Point.getAngles(p, i);
Arrays.sort(angle, comp);
for(int x = 2; x < angle.length; x++){
if(angle[x].angle == angle[x-1].angle && angle[x].angle == angle[x-2].angle){
System.out.print(p[i].toString() + " -> ");
System.out.print(angle[x-2].p.toString() + " -> ");
System.out.print(angle[x-1].p.toString() + " -> ");
System.out.print(angle[x].p.toString());
int y = x+1;
while (y < angle.length && angle[x].angle == angle[y].angle){
System.out.print(" -> " + angle[y].p.toString());
y++;
}
x = x+y-1;
System.out.println();
}
}
}
}
}```