So, in Java I have a large number in the command argument, let's say 12345678910, and I cannot use bigInteger, and I already did:
String[] g = args[1].split("");
So, my string is put in a string array. But, I cannot use:
int[] ginormintOne = new int[g.length];
for(int n = 0; n < g.length; n++) {
ginormintOne[n] = Integer.parseInt(g[n]);
}
It gives me this:
Exception in thread "main" java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at Ginormint.main(Ginormint.java:67)
I think my numbers are too large for int. Any idea on how to convert it to a large number array?
java.lang.Long
? it is 64-bit signed – amphibient Mar 14 at 19:29BigInteger
or any other class with the same functionality. – Marko Topolnik Mar 14 at 19:46