How to convert a hexadecimal string to long in java?
I want to convert a hex string to long in java. I have tried with general conversion. String s = "4d0d08ada45f9dde1e99cad9"; long l = Long.valueOf(s).longValue(); System.out.println(l); String ls = Long.toString(l); But I am getting this error message: java.lang.NumberFormatException: For input string: "4d0d08ada45f9dde1e99cad9" Is there any way to convert String to long in java? Or am i trying which is not really possible!! Thanks! Long.decode(str) accepts a variety of formats: Accepts decimal, hexadecimal, and octal numbers given by the following grammar: DecodableString: Sign opt