Jammed my middle finger playing basketball. Now the joint is swollen and the finger is blackish / blue and hurts. What should I do? How long to heal?

Finger injury. A jammed finger can be a fracture. Get it x-rayed and if normal the finger is sprained and will heal. Can't tell without the x-ray.
ER. Go to the emergency room or your doctor's office and get your hand x-rayed. How long it takes to heal will depend on the x-ray findings - typically 6 to 8 weeks.