One way is to create a rotateAround(x, y, r) function, as Chrisir suggestions, which does translate(x,y) + rotate(r). So: push, rotateAround, drawArm, pop.
The second way is to actually draw your arm around its hinge point – either as a draw routine like drawArm, or as a PShape or PGraphics. This is by far the easiest way – if your components are all centered around 0,0 hinge points, then you can just translate to the place on the body (the shoulder), then rotate (the angle of the arm) and draw, and the arm is always oriented and attached correctly.
So not:
rect(0,0,10,40);
but instead:
rect (-5,-5,10,40);