I keep getting number format expectations, even though I\'m trimming the strings and they don\'t contain non numerical characters bizarrely it works for some numbers and not
The number you're trying to parse is larger than the max value of an Integer, you would have to use a larger data type like Long.
public static void main(String[] args) {
System.out.println("Integer max value: " + Integer.MAX_VALUE);
System.out.println("Long max value: " + Long.MAX_VALUE);
System.out.println();
String n = "3020857508";
Long a = Long.parseLong(n.trim());
System.out.println(a);
}
Results:
Integer max value: 2147483647
Long max value: 9223372036854775807
3020857508