Maximum number of line intersections formed through intersection of N planes | Java implementation of the approach ; Function to count maximum number of intersections possible ; Driver Code
class GFG { static int countIntersections ( int n ) { return n * ( n - 1 ) / 2 ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . println ( countIntersections ( n ) ) ; } }