Mass is determined using gravity, an acceleration. As such its a dynamics not a statics problem.
This is a simplified version on how to do it . . .
Mass affects inertia . . . meaning that the heavier something is, the more 'sluggish' it becomes. Have your arm perform some action and measure the joint rotational velocities. Then have your arm pick up the object, then perform the *exact same* motions again. You'll notice that the joint rotational velocities over time are different. That difference can be roughly mapped to the object mass.
Experimentally have the arm rotate with various masses and measure the dV for each case, then create a look up table, and finally create an interpolation equation with it. Depending on your kinematics and arm configuration, you might be able to map to a single joint (ideal).
note: If your arm is huge but the masses are small, you won't be able to measure any velocity differences. In this case you must add a force sensor to the end effector.
You'll also be able to find various research papers out there that have already attempted to solve this problem.