I think the 'pass' variable is playing a useful role, but the boolean 'done' is not. Why not try:



while(pass<entry.length-1)
{
//algorithm
}