merge java code from pius