Common sorting algorithms implemented using Java