Buggy code:
public class AnimationDataConverter { private List < String > nameOrderList ; public AnimationData convertJsonAnimation ( BVH bvh ) { nameOrderList = new ArrayList < String > ( ) ; String oldName = null ; for ( int i = 0 ; i < ( bvh . getNameAndChannels ( ) . size ( ) ) ; i ++ ) { String newName = bvh . getNameAndChannels ( ) . get ( i ) . getName ( ) ; if ( ! ( newName . equals ( oldName ) ) ) { nameOrderList . add ( newName ) ; oldName = newName ; } } AnimationData data = AnimationUtils . createAnimationData ( ) ; parentIdMaps = new HashMap < String , Integer > ( ) ; jointMap = new HashMap < String , Object3D > ( ) ; matrixMap = new HashMap < String , Matrix4 > ( ) ; for ( int i = 0 ; i < ( nameOrderList . size ( ) ) ; i ++ ) { parentIdMaps . put ( nameOrderList . get ( i ) , i ) ; jointMap . put ( nameOrderList . get ( i ) , THREE . Object3D ( ) ) ; } Map < String , AnimationHierarchyItem > hmap = new HashMap < String , AnimationHierarchyItem > ( ) ; BVHNode root = bvh . getHiearchy ( ) ; AnimationHierarchyItem rootItem = AnimationUtils . createAnimationHierarchyItem ( ) ; rootItem . setParent ( ( - 1 ) ) ; hmap . put ( root . getName ( ) , rootItem ) ; convert ( hmap , root ) ; LogUtils . log ( ( "nc:" + ( nameOrderList . size ( ) ) ) ) ; for ( int i = 0 ; i < ( nameOrderList . size ( ) ) ; i ++ ) { AnimationHierarchyItem abone = hmap . get ( nameOrderList . get ( i ) ) ; data . getHierarchy ( ) . push ( abone ) ; } double ft = bvh . getFrameTime ( ) ; data . setName ( "BVHMotion" ) ; data . setFps ( 30 ) ; <START_BUG> data . setLength ( ( ft * ( bvh . getFrames ( ) ) ) ) ; <END_BUG> for ( int i = 0 ; i < ( bvh . getFrames ( ) ) ; i ++ ) { doPose ( bvh , bvh . getFrameAt ( i ) ) ; matrixMap . clear ( ) ; BVHNode rootNode = bvh . getHiearchy ( ) ; Object3D o3d = jointMap . get ( rootNode . getName ( ) ) ; Matrix4 mx = THREE . Matrix4 ( ) ; Vector3 bpos = THREE . Vector3 ( ) ; bpos . add ( o3d . getPosition ( ) , BVHUtils . toVector3 ( rootNode . getOffset ( ) ) ) ; mx . setPosition ( bpos ) ; mx . setRotationFromEuler ( o3d . getRotation ( ) , "XYZ" ) ; matrixMap . put ( rootNode . getName ( ) , mx ) ; doMatrix ( rootNode ) ; for ( int j = 0 ; j < ( nameOrderList . size ( ) ) ; j ++ ) { AnimationHierarchyItem item = data . getHierarchy ( ) . get ( j ) ; Matrix4 matrix = matrixMap . get ( nameOrderList . get ( j ) ) ; Vector3 pos = THREE . Vector3 ( ) ; pos . setPositionFromMatrix ( matrix ) ; Quaternion q = THREE . Quaternion ( ) ; q . setFromRotationMatrix ( matrix ) ; AnimationKey key = AnimationUtils . createAnimationKey ( ) ; key . setPos ( pos ) ; key . setRot ( q ) ; key . setTime ( ( ft * i ) ) ; item . getKeys ( ) . push ( key ) ; } } return data ; } private Matrix4 nodeToMatrix ( BVHNode node ) { } private void doMatrix ( BVHNode parent ) { } private Map < String , Matrix4 > matrixMap ; private Map < String , Object3D > jointMap ; private Map < String , Integer > parentIdMaps ; private void convert ( Map < String , AnimationHierarchyItem > map , BVHNode parent ) { } private void doPose ( BVH bvh , double [ ] vs ) { } private void setRotation ( Object3D target , String lastOrder ) { } }

Fix:
data . setLength ( ( ft * ( ( bvh . getFrames ( ) ) - 1 ) ) ) ;