Java sample code