Printing sorted array in Java
<p>What the code does is, basically, asks for number of elements that you want to sort,the elements and prints them sorted. Or at least it should. When I run it it would do that:</p>

<p><img src="https://i.stack.imgur.com/2IMaW.png" alt="enter image description here"></p>

<p>What should I do? I'm using <strong>JDK 7</strong> and <strong>IntelliJ IDEA 15</strong>.</p>

<p>And yes, I did google it and I couldn't find anything. And no , I don't want the code, I want opinions.</p>

<pre><code>import java.text.MessageFormat;
import java.util.Scanner;

public class bb {
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        System.out.print("Enter number of elements:");
        int numberOfElements = scan.nextInt();
        System.out.print(MessageFormat.format("Enter {0} {1} ",numberOfElements,"numbers: "));
        int [] elements = new int[numberOfElements];
        for (int i = 0; i &lt; elements.length; i++) {
            elements[i]=scan.nextInt();
            java.util.Arrays.sort(elements);
        }
        System.out.println(java.util.Arrays.toString(elements));
    }
}
</code></pre>