little utility for checking an array is sorted