update the demo code for java style