Solved Dominator in java