import java.util.*; /** * Find all triangles in a given set of lines (connected and intersecting) * * @author Peter.Buettner@gmx.net */ public class FBTriangle { /* a point is identified by a String with the number of the point. * a line is a List containing points * a triangle is a Set containing points (3 of them:-) */ public static void main(String[] args) { // only for creating input: separate lines by '#', points by ',' String[] rows = "0,5,8,10#0,3,7,9#0,2,4,6#0,1#1,2,3,5#1,4,7,8#1,6,9,10".split("#"); // lines will contain Lists with points List[] lines = new List[rows.length]; for (int i=0; i