title: Select three different points of the set of points specified on the plane that make up the triangle of the largest perimeter
body: <p>I don't understand how to fix it. I tried in different ways, but I come to one that considers the perimeter as equal to 0. Please help me fix it</p>
  <pre><code>    ArrayList&lt;Point2D.Double&gt; list = new ArrayList&lt;&gt;();
      Scanner sc = new Scanner(System.in); 
      Random r = new Random(); 
      Point2D.Double p = new Point2D.Double();
      
      System.out.print(&quot;Enter the number of points that will make up the set: &quot;);
      int size = sc.nextInt();
      
      for (int i = 0; i &lt; size; i++) {
          p.x = r.nextDouble()*10;
          p.y = r.nextDouble()*10;
          list.add(p);
          System.out.print(&quot;\n &quot; + p.x + &quot;,&quot; + p.y);
      }
      System.out.println();
      double max = 0;
      for(int i=0; i&lt;size; i++)
          for(int j=0; j&lt;size; j++)
              for(int k=0; k&lt;size; k++)
              {
                  double xi = list.get(i).x, xj = list.get(j).x, xk = list.get(k).x;
                  double yi = list.get(i).y, yj = list.get(j).y, yk = list.get(k).y;
                  double t1=Math.pow(xi-xj, 2) + Math.pow(yi-yj, 2);
                  t1 = Math.sqrt(t1);
                  double t2=Math.pow(xi-xk, 2) + Math.pow(yi-yk, 2);
                  t2 = Math.sqrt(t2);
                  double t3=Math.pow(xk-xj, 2) + Math.pow(yk-yj, 2);
                  t3 = Math.sqrt(t3);
                  if(t1+t2&lt;t3 &amp;&amp; t1+t3&lt;t2 &amp;&amp; j+k&lt;i &amp;&amp; t2+t3+t1&gt;max) max = t1+t2+t3;
                  System.out.print(&quot;\nP = &quot;+ max);
              }
      System.out.print(&quot;\nP = &quot;+ max);
      return 0;
  }
  </code></pre>