Update the Java part to be aligned with Java's state-of-the-art