Write a TestNG program to sort an array in ascending order and add the elements into a List.
For grading, implement the equivalent algorithm as a Python function. The function receives an integer array and returns a new list containing the same elements in nondecreasing order. Preserve duplicates and do not modify the input array.
def sort_into_list(nums):