public long size(int dimensionIndex) {
        if (dimensionIndex < 0 || dimensionIndex >= sizes.length)
            throw new IllegalArgumentException("Illegal dimension index " + dimensionIndex +
                                               ": This has " + sizes.length + " dimensions");
        return sizes[dimensionIndex];
    }
Returns the length of this in the nth dimension

@throws IllegalArgumentException if the index is larger than the number of dimensions in this tensor minus one
vespajlib/src/main/java/com/yahoo/tensor/DimensionSizes.java