The following code works fine and here "inferredOnotology" contains the base ontology and as well as the inferred results.
Please note that this code was tested using pellet 2.1 or 2.2 version, not sure about the latest version of pellet.
OWLOntology inferredOntology;
// Create Reasoner
OWLReasonerFactory reasonerFactory = new PelletReasonerFactory();
OWLReasoner reasoner = reasonerFactory.createReasoner(manager);
// Load the ontologies into the reasoner.
Set<OWLOntology> importsClosure = manager.getImportsClosure(inferredOntology);
reasoner.loadOntologies(importsClosure);
// Reason!
reasoner.classify();
InferredOntologyGenerator iog = new InferredOntologyGenerator(reasoner);
iog.fillOntology(manager, inferredOntology);