Move array-to-integer encode/decode functions into the core Util class.