Java Code i have done