There may be a method in the
Java API that will help with this, but you don't have to rely on that. In fact, it might take you less time to figure it out yourself. If you don't know where to start, why don't you write some ideas down on paper. Write out the steps that it will take to accomplish the task. Feel free to post your ideas here. This forum works very well for "thinking out loud", so to speak.
HTH
Layne