Java demo code