sort_array bubblesort algorithm implementation, modified from the MudOSAlike4DGD project