Merge sort algorithm implemented in Java