title: Calling a getAverage method within another class, on an array
body: <p>I have a class that has some methods, ArrayMin, ArrayMax, ArrayAvg, and a constructor that generates an array of 10 values with numbers between 0-100.</p>
  
  <p>I am not stuck on actually USING the three methods mentioned above. How do I call the methods and get an average, min, and max? I thought I could just do <code>a1.ArrayMax()</code>after creating <code>Array a1 = new Array(10)</code>within my MAIN, but no luck. </p>
  
  <pre class="lang-java prettyprint-override"><code>import java.util.Random;
  
  public class Array {
  
      public int size, avg;
  
      public int ArraySize() {
          return size;
      }
  
      public int ArrayMin(int a[]) {
          int min = a[0];
          for (int i=0; i&lt;a.length;i++) {
              if (a[i] &lt; min) {
                  min = a[i];
              }
          }
  
          return min;
      }
      public int ArrayMax(int a[]) {
  
          int max = a[0];
          for (int i=0; i&lt;a.length;i++) {
              if (a[i] &gt; max) {
                  max = a[i];
              }
          }
  
          return max;
      }
  
      public int ArrayAvg(int a[]) {
  
        int sum = 0; 
        for (int i = 0; i &lt; a.length; i++) {
            sum += a[i]; 
        }
        avg = sum / a.length; 
        return avg;
      }
  
      public Array(int size) {
  
          Random rand = new Random();
          int min = 0, max = 100;
          int[] a = new int[size];
          for (int i=0; i&lt;a.length; i++) {
              int result = rand.nextInt(max-min) + min;
              a[i] = result;
              System.out.println(a[i]);
  
          }   
      }
  }
  </code></pre>