If you are writing several arrays one after another then you later need a way to separate the arrays when reading. In this case you can write the array size before each array and then when you read the data you first read the length and then know how many bytes you should read.
If you are only writing a single array to a file then it is simpler as you only need to read the whole file.