issue #13 Add javadoc and sample (also for issue #19)