public float getValueAtTime(long time) {
        if (keyTimes.length == 0) {
            return 0;
        }
        
        // If the time is outside the range, 
        // we just return the closest value. (No extrapolation)
        if (time <= keyTimes[0]) {
            return keyValues[0];
        } else if (time >= keyTimes[keyTimes.length - 1]) {
            return keyValues[keyValues.length - 1];
        }
        
        

        int startFrame = 0;
        int endFrame = 1;
        int lastFrame = keyTimes.length - 1;
        
        for (int i = 0; i < lastFrame && keyTimes[i] < time; ++i) {
            startFrame = i;
            endFrame = i + 1;
        }
        
        long keyTime1    = keyTimes[startFrame];
        float keyValue1  = keyValues[startFrame];
        long keyTime2    = keyTimes[endFrame];
        float keyValue2  = keyValues[endFrame];
        
        if (keyTime2 == time) {
            return keyValue2;
        }
        
        long prevToNextDelta    = keyTime2 - keyTime1;
        long prevToCurrentDelta = time     - keyTime1;
        float lerpAmount = (float)prevToCurrentDelta / prevToNextDelta;
        
        return FastMath.interpolateLinear(lerpAmount, keyValue1, keyValue2);
    }
Retrieve the curve value at the given time.
If the curve has no data, 0 is returned.
If the time is outside the curve, then the closest value is returned.
If the time isn't on an exact keyframe, linear interpolation is used
to determine the value between the keyframes at the given time.
@param time The time to get the curve value at (in FBX time units).
@return The value at the given time.
jme3-plugins/src/fbx/java/com/jme3/scene/plugins/fbx/anim/FbxAnimCurve.java