Byte array to string

Hi, im new to arduino programing and i have trouble with byte array converting to array.

byte addr[8];

...

 if(status=="ok"){

     byte i;
     for( i = 5; i >0; i--) {

        byte x = addr[i];
   if(x < 0x10)
   {
     Serial.print('0');
   }
          Serial.print(addr[i],HEX);  

     }

It print me ex. 0A0B0C0D which is perfect result. But i must do some modification in this values, that i need to get them to an array (with leading 0's).

How to do it?

Thanks for using code tags, but always post ALL the code.

This will not work if "status" is not a String, and we recommend to avoid Strings.

if (status=="ok")

Please try again to explain your question. I have no idea what you want to do.

The code you posted can not print 4 hexadecimal digits. The for() loop executes 5 times.

look up the sprintf() function

char array[9];
for( i = 5; i >0; i--) {
  sprintf( array+ (5-i)*2, "%02X", (unsigned int)addr[i]);
}

Also, give a example of the modification you wish to perform on the byte array contents.
There may be an easier way than creating a text representation of the values.