An implementation of merge and quick sort with java generics