title: Finding the max value of an array
body: <p>I've searched around for an answer but haven't had much luck trying to get the following to work.</p>
  
  <p>I am currently taking a introductory programming class and have been faced with a exercise where I need to write two functions (i.e. a method that returns a value) that </p>
  
  <p>a) Returns the maximum value and<br>
  b) The median value, from an array of double values.</p>
  
  <p>Below is the code of where I am up to. I have successfully created a method that allows the user to input the the number of elements of the array and initialize them with a value. I am however having difficulty getting the method for calculating the maximum to work. I've explicitly been told to use the Math.max method. However whenever I try to run the code, I get the following error message after the user has initialized the array:</p>
  
  <pre><code>"Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
      The method max(double, double) in the type Math is not applicable for the arguments (double, double[])"
  </code></pre>
  
  <p>From what I have read in the API <code>Math.max</code> can handle double types. I'm a little clueless as to how to fix this. I have a feeling I need to create a loop, but I was under the impression the <code>foreach</code> loop is equivalent.</p>
  
  <p>All responses will be greatly appreciated.</p>
  
  <pre><code>package com.gc01.lab2;
  
  import java.util.Scanner;
  
  public class exercise22 {
  
      private static double [] numberInput(){
          Scanner input = new Scanner (System.in);
  
          System.out.println("How many numbers are in the array?");
          int count = input.nextInt();
          double [] array = new double [count];
  
          for (int i = 0; i &lt; count; ++i){
              System.out.println("Enter number " + i + ": ");
              array [i] = input.nextDouble();
          }
          return array;
      }
  
      private double  maximum (double [] array){
          double max = 0.0;
          for (double value : array){
              max = Math.max(0.0, array);
          }
          return  max;
      }
  
      public static void main(String[] args) {
          // TODO Auto-generated method stub
          final exercise22 object = new exercise22 ();
          System.out.println("The maximum number inputted is " +
                  object.maximum(object.numberInput()));
  
      }
  
  }
  </code></pre>