I guess I should add a check, but it's omissible regardless. As long as you never call heapSort directly, this case will never occur. QuickSortImpl will use insertion sort if r.length <= 25.