java prob1 added with loop reduced