// Java Program to illustrate Reading from FileReader // using BufferedReader Class // Importing input output classes import java.io.*; import java.util.Arrays; public class Main { public static boolean containsTrue(boolean[] array) { for (boolean val : array) { if (val) return true; } return false; } public static boolean checkAnySamePoint(double[] a, double[] b, double[] c) { boolean a_bSame = a == b; boolean a_cSame = a == c; boolean b_cSame = b == c; boolean[] testArray = { a_bSame, a_cSame, b_cSame }; return containsTrue(testArray); } public static void main(String[] args) { System.out.println("test_iterate"); double[][] point_list = { { -5, 2 }, { 0, 2 }, { 8, 2 }, { 8, -11 }, { 4, 2 }, { 4, 5 }, }; double[] test_d = { 1, 2, 3 }; for (double d : test_d) { System.out.println(d); } // 1 for (double[] xy_a : point_list) { for (double[] xy_b : point_list) { // test if same point double[][] list = { xy_a, xy_b }; long t = Arrays.stream(list).distinct().count(); // if a and b is not the same point if (t == 2) { for (double[] xy_c : point_list) { // if a and b and c is not the same point double[][] list_t = { xy_a, xy_b, xy_c }; long tt = Arrays.stream(list_t).distinct().count(); if (tt == 3) { System.out.print(xy_a[0] + "/" + xy_a[1]); System.out.print("," + xy_b[0] + "/" + xy_b[1]); System.out.print("," + xy_c[0] + "/" + xy_c[1]); System.out.print("==" + checkAnySamePoint(xy_a, xy_b, xy_c)); System.out.println(""); } else { // skip if a and b and c is same } } } else { // skip if a and b is same } } } } }