I am having a hex string as "d41d8cd98f00b204e9800998ecf8427e" ..
i need to convert this hex string into long
I did something following
long strLong= Long.parseLong(s,16);
But at the runtime i am getting following error :
java.lang.NumberFormatException: For input string: "d41d8cd98f00b204e9800998ecf8427e"
Your code, in concept, is fine. But a long in Java is a 8 bytes signed (two's complement) value. So it's maximum value is 2^63 - 1, or 7FFF FFFF FFFF FFFF in hex. The number you are providing is a wee bit bigger that that. ;) If you run your code with a smaller hex value it will work fine.
To work with a number that big, you'll need to use the BigInteger class (or BigDecimal if you need a floating number).