v1 of Java sample code