added api example for java