added code example in java-doc