Update Java example and use a final local instead of a global static variable