Finished off Java version of extended example