Java testing code