Java sample codes