This is a common way to do it:
long l = Long.parseLong(str);
There is also this method: Long.valueOf(str); Difference is that parseLong returns a primitive long while valueOf returns a new Long() object.
This is a common way to do it:
long l = Long.parseLong(str);
There is also this method: Long.valueOf(str); Difference is that parseLong returns a primitive long while valueOf returns a new Long() object.