I am writing a code for converting a number given in string to integer. But it gives Number Format Exception for more than 9 digit number. Is there any other way for doing this.
public class StringToInt {
public static void main(String args[])
{
try
{
long test =Integer.valueOf("9007199254");
System.out.println("num :"+test);
}catch(NumberFormatException e)
{
System.out.println("Error..."+e.toString());
}
}
}
longLong.valueOfnotIntegerintlimit is till2,147,483,647