how to Convert a String with 22 length to an integer in java

Mir.Ebrahim Jafarpour Zonuzi :

i want to send data via sockets and my device don`t get strings so i have to convert my string to int how i have to do it?

i have an string up to 22 chars and i must send it via sockets as integer or long or anything in numbers format but any data type in java cannot hold more than 8 bytes what should i do?

i also tried these codes :

long l = Long.valueOf(message, 16);// message="11EE0000AA0000FF03A901"

long l = Long.parseLong(message, 16);// message="11EE0000AA0000FF03A901"

int l = Integer.parseInt(message, 16);// message="11EE0000AA0000FF03A901"

Wall :
BigInteger val = new BigInteger(message, 16);
System.out.println(val);

Try this !

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=133672&siteId=1