rotating arm

hello, I’m trying to make the arm of the player sprite rotate to follow the mouse. However, I have no idea how to start about doing this. I am using mouseListener and mouseMotionListener, and I am rotating the arm using this:

 AffineTransform tx = AffineTransform.getRotateInstance(rotationRequired, player.weapon.img.getWidth(null) / 2, player.weapon.img.getHeight(null) / 2);
       AffineTransformOp op = new AffineTransformOp(tx, AffineTransformOp.TYPE_BILINEAR);
       g2d.drawImage(op.filter((BufferedImage)player.weapon.img, null), player.weapon.x, player.weapon.y, null);

Well…you have no idea how to do this…but you have code…does it work?

Assuming that the arm pivots at the shoulder, the you simply have a direction vector between the point of the shoulder to the point of the mouse. Normalize. Done.

I’m googling it…but I’m only in middle school, so I may not be able to understand this…