Here is merger sort in java with different scenarios