How to make an array immutable?

I’m working on a project in which I want to ensure that my dataset can’t be changed or modified in any case. I have to make sure the array’s value didn’t change in any situation. I have found a code that claimed it makes an array immutable but I’m not getting what it is trying to do. Here’s a code below:

Can someone explain this code to me? You can also share any other alternative approaches that help me.