How to perform string Diffs in Java?
This library seems to do the trick: google-diff-match-patch. It can create a patch string from differences and allow to reapply the patch.
edit: Another solution might be to https://code.google.com/p/java-diff-utils/
Apache Commons has String diff
org.apache.commons.lang.StringUtils
StringUtils.difference("foobar", "foo");