Instead of using Arrays.sort(array);, I have to rewrite what people wrote before? Now is there a point? For better understanding? Why don't you simply ask students to rewrite the whole Java language, for "better understanding"?. Rebuilding the wheels is so overrated.