static long toValueIndex(long[] indexes, DimensionSizes sizes) {
        if (indexes.length == 1) return indexes[0]; // for speed
        if (indexes.length == 0) return 0; // for speed

        long valueIndex = 0;
        for (int i = 0; i < indexes.length; i++) {
            if (indexes[i] >= sizes.size(i))
                throw new IllegalArgumentException(Arrays.toString(indexes) + " are not within bounds");
            valueIndex += sizes.productOfDimensionsAfter(i) * indexes[i];
        }
        return valueIndex;
    }
Returns the value at the given <i>standard value order</i> index as a float.

@param valueIndex the direct index into the underlying data.
@throws IllegalArgumentException if index is out of bounds
vespajlib/src/main/java/com/yahoo/tensor/IndexedTensor.java