Improve some codes in learning java mail