add previous java code