converted to JAVA