This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I would say hex is nowhere a type. It's a notation-convention. 0xFF00AA55 is a 4-byte Hexvalue, and might be 4 bytes, a 4-byte Number, a 4-byte Color (transparency, RGB) or an header. I'm not used to Printwriter - looks a bit curious to me in this context.
And the javadocs show me that I'm right:
It does not contain methods for writing raw bytes, for which a program should use unencoded byte streams.
Are you bound to Printwriter, or may you use another kind of Stream?
If you use Java Strings, be sure the other end is expecting unicode rather than ASCII.
One question - when you say "header is supposed to be in hex", do you actually mean it's supposed to be characters representing the number in hexadecimal notation, or is what's really meant that the header is supposed to be in raw binary? If the latter, you'll probably need to convert to bytes and send that.