Some example code for Java