private static double[] readValues(TokenBuffer buffer, int size, TensorAddress address, TensorType type) {
        int index = 0;
        double[] values = new double[size];
        if (buffer.current() == JsonToken.VALUE_STRING) {
            values = decodeHexString(buffer.currentText(), type.valueType());
            index = values.length;
        } else {
            expectArrayStart(buffer.current());
            int initNesting = buffer.nesting();
            for (buffer.next(); buffer.nesting() >= initNesting; buffer.next()) {
                if (buffer.current() == JsonToken.START_ARRAY || buffer.current() == JsonToken.END_ARRAY) continue; // nested arrays: Skip
                values[index++] = readDouble(buffer);
            }
            expectCompositeEnd(buffer.current());
        }
        if (index != size)
            throw new IllegalArgumentException((address != null ? "At " + address.toString(type) + ": " : "") +
                                               "Expected " + size + " values, but got " + index);
        return values;
    }
Reads values for a tensor subspace block

@param buffer the buffer containing the values
@param size the expected number of values
@param address the address for the block for error reporting, or null if not known
@param type the type of the tensor we are reading
@return the values read
document/src/main/java/com/yahoo/document/json/readers/TensorReader.java