corrected java API example