title: How to format arrays in a different method?
body: <p>How would I format my array as this? I've tried many different methods but I can't seem to get it to work. </p>
  
  <p>I want it to return something like this 
  "Avg of 1 2 3 4 5 is 3.00"</p>
  
  <pre><code>public class AverageNumber {
  
  private static int[] n = new int[5];
  private static double total = 0;
  
  public static void main(String[] a) { 
      AverageNumber object = new AverageNumber();
      object.Dialogue();
  }
  
  private void Dialogue() { 
      int count = 1;
  
      System.out.println("Skriv inn 5 tall" + count++);
      for(int i=0; i&lt;n.length; i++){
          n[i] = Konsoll.readInt("Tall");
          total = total + n[i];
      }
  
      double avg = total / n.length;
  
      System.out.println("Avg of " + formatArray() + "  is " + avg); 
  }
  
  private static double formatArray() {
      //Return all numbers
  }
  </code></pre>
  
  <p>}</p>