private Single ConvertHexToSingle(string hexVal)
{
try
{
int i = 0, j = 0;
byte[] bArray = new byte[4];
for (i = 0; i <= hexVal.Length - 1; i += 2)
{
bArray[j] = Byte.Parse(hexVal[i].ToString() + hexVal[i + 1].ToString(), System.Globalization.NumberStyles.HexNumber);
j += 1;
}
Array.Reverse(bArray);
Single s = BitConverter.ToSingle(bArray, 0);
return (s);
}
catch (Exception ex)
{
throw new FormatException("The supplied hex value is either empty or in an incorrect format. Use the " +
"following format: 00000000", ex);
}
}