I am trying to create a method that when called will break an String consisting of an integer into individual digits, then converting these digits into integers and fill an array with these integers.
I keep getting the error:
java.lang.NumberFormatException: For input string: ""
at java.lang.NumberFormatException.forInputString(Num berFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:504)
at java.lang.Integer.parseInt(Integer.java:527)
at add.stringSplit(add.java:56)
at add.main(add.java:27)"
I feel really stupid and have been looking for solutions online, but I can't find anything relevant.
Any help would seriously be appreciated. I wasted my whole Saturday on this.
private int[] stringSplit (String fullString) { int[] tempArray = new int[fullString.length()]; for(int i = 0; i < fullString.length(); i++) { String x = fullString.substring(i,i); tempArray[(i)] = Integer.parseInt(x); } return tempArray;