Taking a byte value, then transforming it to a string to parse it to an integer is insane.
You should realize that a byte value is basically a number, as is an integer value, and there is no need to convert anything, let alone using a string in the middle...
a6 is not equivalent to 166, a6 and 166 are two ways to represent THE SAME VALUE.
So you just should write
int noofdata = (int)numdata;
int noofdata = (int)ADVERTISEMENT_DATA_BYTE;
But I think you should study toroughly what are datatypes (in .NET, and in development in general) and how to use them.