Converting byte data to hex and then Sending HEX values via Arduino serial

Okay. I'm having this callback function where the variable payload of data type byte* gets the data from the the Bluemix server. Here is the code which i'm using.

void callback(char* topic, byte* payload, unsigned int payloadLength) 
{
  char x;
  for (int i = 0; i < payloadLength; i++)
  {
    x = payload[i];
    if ( (x>='0' && x<='9') ? (x-'0') : ( (x>='A' && x<= 'F') ? ( (x-'A')+10):(0) ) )
    {
      Serial.write(x);
    }

  }
}

So if payload contains 'F' the above code sends 46 which is the ascii representation.

What i want is that it should send 15 when payload receives 'F'. Because F is 15 in hex.

I'll give you another example of code.

int x = 0x0f;
Serial.write(x);

The above code sends 15 when i use Serial.write(x).

Now, have i made myself clear? If not please let me know. I'm really getting confused between the data type conversions over here.

Regards,

Nishit.