Hi professor, sorry to bother you, but im having some dificult here to make your code work  ???

This is my code in OPascal
not much dif from java
[code]
        dx := ball[i].cx - ball[n].cx;
        dy := ball[i].cy - ball[n].cy;
        dist := Sqrt(Power(dx, 2) + Power(dy, 2));
        if dist <= (ball[i].raio + ball[n].raio) then
        begin
          ax := dx / dist;
          ay := dy / dist;
          vp_n := (ball[n].vx * ax) + (ball[n].vy * ay);
          vp_i := (ball[i].vx * dx) + (ball[i].vy * ay);
          dt := ((ball[i].raio + ball[n].raio) - dist) / (vp_n + vp_i);
          ball[n].x := ball[n].x - (ball[n].vx * dt);
          ball[n].y := ball[n].y - (ball[n].vy * dt);
          ball[i].x := ball[i].x - (ball[i].vx * dt);
          ball[i].y := ball[i].y - (ball[i].vy * dt);
[/code]

You can see something wrong ?

*sorry my bad english, im from brazil

EDIT: If u can send me the source code to my email it will be helpfull too