Added Java API example, closes #6