Solve problems 1,3,6,9 using Java.