title: How to get maximum value from double data type value set?
body: <p>I get the five double data type values from five different function.Without adding those value into array is there any efficient java code for get the maximum value from that five value set.</p>
  
  <pre><code>double d1=r1.function1();
  double d2=r1.function2();
  double d3=r1.function3();
  double d4=r1.function4();
  double d5=r1.function5();
  
  double[] d=new  double[5];
  for(int i=0:i&lt;5;i++){
      d[i]="d"+i;
  }
  double x=max(d);
  
  public static double max(double[] t) {
      double maximum = t[0];   // start with the first value
      for (int i=1; i&lt;t.length; i++) {
          if (t[i] &gt; maximum) {
              maximum = t[i];   // new maximum
          }
      }
      return maximum;
  }
  </code></pre>
  
  <p>Without going this much effort is there any efficient way to get the maximum value from above double type data set? And also when adding value to the loop there also some error represent in <code>d[i]="d"+i;</code> part. Please provide me better solution.</p>