Some Java codes