This is a forum for people working with the Atlassian software suite. While there's a lot of java here because the applications are written in Java, it is not the right place to ask generalised java coding questions.
I suggest you look for a more java related place - most people here are not expert java coders (I could give you an answer, but I'm really not a coder, so my answer probably wouldn't be the best way to do it, or elegant, and I might have to look it up. People in more relevant forums could probably give you better answers without thinking)
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG