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
You could use
String n="3020857508"; Long a = Long.valueOf(n.trim()).longValue(); System.out.println(a);