codes from java