code: private TrellisNode[][] getTrellis(int[][] sequence) {
          TrellisNode[][] trellis = new TrellisNode[sequence.length][numClasses];
  
          TrellisNode[] t0 = trellis[0];
          for (int i = 0; i < numClasses; i++) {
              t0[i] = new TrellisNode(true);
              t0[i].sparseSamples[0] = featureset(sequence[0], numClasses);
          }
  
          for (int t = 1; t < sequence.length; t++) {
              trellis[t][0] = new TrellisNode(true);
              TrellisNode tt0 = trellis[t][0];
              for (int j = 0; j < numClasses; j++) {
                  tt0.sparseSamples[j] = featureset(sequence[t], j);
              }
  
              for (int i = 1; i < numClasses; i++) {
                  trellis[t][i] = new TrellisNode(true);
                  TrellisNode tti = trellis[t][i];
                  System.arraycopy(tt0.sparseSamples, 0, tti.sparseSamples, 0, numClasses);
              }
          }
  
          return trellis;
      }
docs: Create a trellis of a given sequence for forward-backward algorithm.
  
  @param sequence the feature sequence.