code: private static SparseTensor resizeIntoTable(int[] dimensions, int[] dimensionSizes,
        long[] keyNums, double[] values, int size) {
      if (values.length == size) {
        return new SparseTensor(dimensions, dimensionSizes, keyNums, values);
      } else {
        // Resize the result array to fit the actual number of result
        // keyNums.
        long[] shrunkResultKeyInts = ArrayUtils.copyOf(keyNums, size);
        double[] shrunkResultValues = ArrayUtils.copyOf(values, size);
        return new SparseTensor(dimensions, dimensionSizes, shrunkResultKeyInts, shrunkResultValues);
      }
    }
docs: Takes the data structures for a {@code SparseTensor}, but
  possibly with the wrong number of filled-in entries, resizes them
  and constructs a {@code SparseTensor} with them.
  
  @param keyNums
  @param values
  @param size
  @return