How to convert String to Long?

2.44K viewsJava

how to convert string to long  java?

Manohar Changed status to publish July 16, 2021
Add a Comment

Use the below snippet :

public static Long convertStringToLong(String stringValue) {
NumberFormat numberFormat = NumberFormat.getInstance();
Number number = numberFormat.parse(stringValue);
return number.longValue();
}catch(Exception e){
return null;


Manohar Changed status to publish June 24, 2021
Add a Comment
Write your answer.