hi,
i am trying to use parseByte function on hex string it show exception number out of Range.NotNumberFormat exception thrown out.
pls tell me why it is. my expression is like this
byte b=Byte.parseByte("ac",16);
it shows above error pls help me.pls explain in simple language.

The string vaue must be in the range for a byte, ie -128 to +127 (ie -80 to 7f hex). Your value of ac is too large for a byte.

If I guess your intent properly, then you can get the result you want by parsing the string into an int, then just taking the last 8 bits from the int, eg
byte b= (byte) (Integer.valueOf("ac",16) & 0xff);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.