Codes from Java class