I'm not sure I fully understand the code here, but why are you moving the balls in the direction they were travelling before the collision, after finding that they've collided?
The balls are moved to the new direction, not to the old. To make sure that they dont collide anymore.
Could it be possible that the new speeds should be calculated before the balls get moved?
If I understand you right, you mean something like this:
xSpeed[i] = newVelX1(xSpeed[i], xSpeed[j]);
xSpeed[j] = newVelX2(xSpeed[i], xSpeed[j]);
ySpeed[i] = newVelY1(ySpeed[i], ySpeed[j]);
ySpeed[j] = newVelY2(ySpeed[i], ySpeed[j]);
Ball[i].move(newVelX1(xSpeed[i], xSpeed[j]) * dt, newVelY1(ySpeed[i], ySpeed[j]) * dt);
Ball[j].move(newVelX2(xSpeed[i], xSpeed[j]) * dt, newVelY2(ySpeed[i], ySpeed[j])* dt);
or
xSpeed[i] = newVelX1(xSpeed[i], xSpeed[j]);
xSpeed[j] = newVelX2(xSpeed[i], xSpeed[j]);
ySpeed[i] = newVelY1(ySpeed[i], ySpeed[j]);
ySpeed[j] = newVelY2(ySpeed[i], ySpeed[j]);
Ball[i].move(xSpeed[i] * dt, ySpeed[i] * dt );
Ball[j].move(xSpeed[j] * dt, ySpeed[j] * dt );
Good Idea, but this doesn't solve the problem.
It's weird: sometimes, when two balls which stick together, collide with one single ball, the collusion seems to be correct.
If you have time, you can compile the code by yourself and watch it.