Sorting method in 《Introduction to Algorithms》 coding in java