Added Conditions, Loops - Java