How to save HEX array to String?

Then you need to decode the received packet to obtain the length, read only read that number of bytes. Or, if you want to dumb it down a lot, you can just read a fixed number of bytes.