Serial.read() cut leading 0 ?

I’m expecting this kind of packages from serial2.read(): 55 AA 07 20 65 00 04 28 27 00 00 20 FF 55 AA 09 20 64 00 06 28 27 00 00 72 00 AB FE 55 AA 06 21 64 00 02 05 00 00 6D FF

But through the Serial Monitor im getting:

55 AA 7 20 65 0 4 29 27 0 0 1 55 AA 9 20 64 0 6 29 27 0 0 72 0 AA EF 55 AA 6 21 64 0 0 5 0 0 6 FF

Can anyone explain me why Serial2.read(); cut leading 0´s?

uint8_t test ;

void setup()
{
Serial.begin(115200);
Serial2.begin(115200);

}


void loop() {
test = Serial2.read();
 Serial.print(test, HEX);
}

It didn't. The print method did.

Anyone a hint for that?

AWOL: It didn't. The print method did.

But, some has to take the responsibility to some extent as he has indirectly told the print method (for good reason) not to handle the leading 0s while dealing with human friendly display device like Serial Monitor/LCD. We (the human beings) feel comfort to visualize 15 instead of 015. Now, the OP needs leading 0s to have printed in the Serial Monitor; so, he has do it himself.

rosch94:
Anyone a hint for that?

byte test = Serial2.read();
if(the value of test is less than this: 0x10) //you have 00, 01, 00, ...., 0F
{
    Show 0 (zero) on Serial Monitor. How? Serial2.print('0'); or Serial2.write(0x30);
}
Serial2.print(test, HEX);   // ypu are getting 00, 01, ..., 0F, 10, ........, FF

GolamMostafa: byte test = Serial2.read(); if(the value of test is less than this: 0x10) //you have 00, 01, 00, ...., 0F {     Show 0 (zero) on Serial Monitor. How? Serial2.print('0'); or Serial2.write(0x30); } Serial2.print(test, HEX);  // ypu are getting 00, 01, ..., 0F, 10, ........, FF

thanks works fine :) Just a little changes are needed