title: Why does my code output [D@3d4eac69 when I tell it to return the array?
body: <pre><code>import java.util.Scanner;
  import java.util.Arrays;
  
  public class rr {
  
  public static void main(String[] args)  { 
  int i =1;
  Scanner input = new Scanner(System.in);
  System.out.print("Please enter the number of data points: ");
  int data = input.nextInt();
  double [] userArray = new double[data];
  if(data &lt; 0){
      System.out.println("The number should be posotive. Exiting.");
  }
  else {System.out.println("Enter the data:"); }
  while (i &lt;= data) {
   int userInput = input.nextInt();
         i ++;
  
   } 
  insertionSort(userArray);
  }
  
  static void insertionSort(double[] arr) {
    int i, j;
    double newValue;
    for (i = 1; i &lt; arr.length; i++) {
          newValue = arr[i];
          j = i;
          while (j &gt; 0 &amp;&amp; arr[j - 1] &gt; newValue) {
                arr[j] = arr[j - 1];
                j--;
          }
          arr[j] = newValue;
    }
    System.out.println(Array.toString(arr));
  }
  }
  </code></pre>
  
  <p>The program is supposed to take the values inputted by the user, sort them with the insertionSort method, then print it. I think that the values are being sorted but they are not being printed for some reason. </p>