I'm trying to simulate 2D balls to colliding. Somehow I messing up things, but I can't really see what it is. If anyone could point me in the right direction, so to speak. The iterating works and the collision is detected like it should be. The problem occurs when I try to calculate the new velocity.

Java Code:
            if(2500 > Math.pow(b.getX() - x, 2) + Math.pow(b.getY() - y, 2)){
               //  System.out.println("collision OK!");
               double pvX = b.getX() - x;
               double pvY = b.getY() - y;
               double vXE = b.getVelocityX();
               double vYE = b.getVelocityY();
               double v = (vYE * pvY + vXE * pvX) / (pvX * pvX + pvY * pvY);
               pixelsXPerMilli += v * pvX;
               pixelsYPerMilli += v * pvY;
            }