Java code that I have written.