Java String to long

We can convert String to long in java using Long.parseLong() method.

Scenario

It is generally used if we have to perform mathematical operations on the string that contains long number. Whenever we get data from textfield or textarea, entered data is received as a string. If entered data is long, we need to convert string to long. To do so, we use Long.parseLong() method.

Signature

public static long parseLong(String s)

EXAMPLE

Flash Soon



Advertisement

© Sapster 2017