add javadoc and example