Converted to Java