Implementations of different sortings in Java