Solve problem 70 using Java.