default int sizeAsInt() {
        long size = size();
        if (size > Integer.MAX_VALUE)
            throw new IndexOutOfBoundsException("size = " + size + ", which is too large to fit in an int");
        return (int) size;
    }
Returns the size of this as an int or throws an exception if it is too large to fit in an int.
Prefer this over size() with implementations that only handle sizes in the int range.

@throws IndexOutOfBoundsException if the size is too large to fit in an int
vespajlib/src/main/java/com/yahoo/tensor/Tensor.java