Java Program to display the elements in ascending order.

Output: