External sorting implementation in java