title: Return the amount of numbers below average
body: <p>I am trying to write a program that returns the amount of numbers less than the average</p>
  
  <p>For example, if I have the numbers 2, 3 and 4, the average would be (2.1+3.6+4.2)/3 = 3.3 and since 2.3 is below average it would return 1 as there is one number below the average.</p>
  
  <p>I am getting an error that says</p>
  
  <pre class="lang-none prettyprint-override"><code>Type mismatch: cannot convert from double[] to int
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>public static void main(String[] args) {
  
      double[] numbers = {2.1, 3.6, 4.2};
  
      System.out.println(belowaverage(numbers));
  }
  
  
  
  public static int belowaverage(double[] ba) {
      double sum = 0;
      double average = 0;
  
      for(int i = 0;i&lt;ba.length;i++){
          sum = sum + ba[i];
          average = sum / ba.length;
          if(ba[i]&lt;average){
          return ba;
      }
  }
  </code></pre>