You need to set ptr to the serialized form of the array you created. That's what returns the now evaluated value. Something like:

    ptr.set(getDataType().toBytes(array));