var ba = Encoding.Default.GetBytes("0xFFFF"); var hexString = BitConverter.ToString(ba); hexString = hexString.Replace("-"