Various sorting algorithms in Java