added Java sample code.
support oob.