I swear it's not homework or something. I just thought it would be interesting to see what you guys come up with!
Just found this example on the web. While I believe you that it is not your homework assignment -- it is clearly an assignment for some java class. I don't think the teacher would appeciate us putting possible answers for the assignment on the web.