private static float[] totalWeights(Mesh[] meshes, Armature skeleton) {
        int numBones = skeleton.getJointCount();
        float[] result = new float[numBones];
        for (Mesh mesh : meshes) {
            RagUtils.addWeights(mesh, result);
        }

        List<Joint> bones = preOrderJoints(skeleton);
        Collections.reverse(bones);
        for (Joint childBone : bones) {
            int childIndex = skeleton.getJointIndex(childBone);
            Joint parent = childBone.getParent();
            if (parent != null) {
                int parentIndex = skeleton.getJointIndex(parent);
                result[parentIndex] += result[childIndex];
            }
        }

        return result;
    }
Calculate the total bone weight animated by each bone in the specified
meshes.

@param meshes the animated meshes to analyze (not null, unaffected)
@param skeleton (not null, unaffected)
@return a map from bone indices to total bone weight
jme3-jbullet/src/main/java/com/jme3/bullet/animation/RagUtils.java