cleaned up PrimitiveUtil. ByteArray conversion is still kinda slow because of boxing