Java code samples for various things