Welcome to the Official BlackBerry Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
My feeling is that this is a more general Java question, rather than a specific Blackberry question, so I would look else where for sample algorithms. This forum is targeted towards Blackberry specific issues.