Sort enemy array in changing target

Hi, i wan to ask any idea how to implement the scrolling to switch enemy target locking in terms of sorting enemy array in ascending or descending order? thank you!