miscellaneous Java codes