code: public static double max(final double a, final double b) {
          if (Double.isNaN(a)) {
              return b;
          } else if (Double.isNaN(b)) {
              return a;
          } else {
              return Math.max(a, b);
          }
      }
docs: <p>
  Gets the maximum of two <code>double</code> values.
  </p>
  
  <p>
  NaN is only returned if all numbers are NaN as per IEEE-754r.
  </p>
  
  @param a
  value 1
  @param b
  value 2
  @return the largest of the values