added java version of Sum2 and Prime