Solve problems 22,26,30 using Java.