translated example 6 to Java
translated example 7 to Java
translated example 8 to Java
translated example 9 to Java
translated example 10 to Java