If the accelerometer measures acceleration in meters per second squared (SI unit), you can convert each acceleration to a g-force measurement by dividing by 9.81.
If you want the g-force to be measured without indicating direction, you just need to apply the pythagorean theorem to the various acceleration components:
double g = Math.sqrt(x * x + y * y + z * z);
source
share