Potentially useful Java code