Q:

ParseInt crashes on longer numbers

After a few weeks i finally found out how to parse my numbers through my app. But now the app crashes when given a number in the following format: 92839283982938 or 22.483.84.3883.
I just dont know how to make it accept those number formats. The problem is connected to a barcode scanner, so i really need it to accept those number formats.
The code i used to parse is:
JSONObject c = user.getJSONObject(Integer.parseInt(xyz)-1);

A:

For longer number you should use Long.parseLong() instead of Integer.parseInt().
Next case 22.483.84.3883 not a numeric. You will get NumberFormatException from here.
You can use 
try{
   long val=Long.parseLong("xxxx")
}catch(NumberFormatException e){
   // exception 
}

If you want to consider 22.483.84.3883 or 22-483-84-3883 as a valid case, you need to replace . or - first.
Eg:
 long val=Long.parseLong("22.483.84.3883".replaceAll("\\.", ""));
 System.out.println(val);

