Java interfacing code