// For complete examples and data files, please go to https://github.com/groupdocs-comparison/GroupDocs.Comparison-for-Java
InputStream sourceStream = Main.Utilities.sourceStream(sourceFile);
InputStream targetStream = Main.Utilities.targetStream(targetFile);
// Create instance of GroupDocs.Comparison.Comparison and call method Compare.
Comparison comparison = new Comparison();
InputStream result = comparison.compare(sourceStream, targetStream, Main.Utilities.outputFileName(extension), ComparisonType.Words);