Java arrays in methods
<p>I'm making a method that take a list of arrays and finds the average of the numbers.
I know that my method works since I just moved it from my main method to the "average" method. I'm just having problems getting the array to work with the method. </p>

<p>I'm not sure if I'm wrong by calling the method by <code>average(a);</code>, or if it's because the method is written as <code>public static void average(double[] a){</code> </p>

<p>Could someone point me to the right direction?</p>

<pre><code>public class Ass10{

    public static void main(String[] args) {
        System.out.println("asdf");
        int a[] = {1, 2, 3,4};
        average(a);
      }

    public static void average(double[] a){
        int sum = 0;

        for (int counter = 0; counter&lt;a.length;counter++){
            sum += a[counter];
        }
                System.out.println(sum/a.length)

        }
</code></pre>
