This is a test, so you need to come up with something your self. Also I am not a Java programmer, so I do not know if C++ syntax will work for a Java program.
Do the work and post your code. Then maybe someone that is familiar with Jave may be able to help you better.