Convert Java 7 code to Java 6 equivalent