Array utilities and tests