Factor some of the Java API examples out of the README