java convert integer to int array
<p>i try to convert an integer to array for example 1234 to int[] arr = {1,2,3,4}; i've wrote a function </p>

<pre><code>public static void convertInt2Array(int guess)  {
    String temp = Integer.toString(guess);
    String temp2;
    int temp3;
    int [] newGuess = new int[temp.length()];
    for(int i=0;i&lt;=temp.length();i++) {
        if (i!=temp.length()) {
            temp2 = temp.substring(i, i+1);
        } else {
            temp2 = temp.substring(i);
            //System.out.println(i);
        }
        temp3 =  Integer.parseInt(temp2);    
        newGuess[i] = temp3;
    }
            for(int i=0;i&lt;=newGuess.length;i++) {
                System.out.println(newGuess[i]);
            }          
}
</code></pre>

<p>but that is a exception throw out</p>

<pre><code>Exception in thread "main" java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:504)
    at java.lang.Integer.parseInt(Integer.java:527)
    at q4.test.convertInt2Array(test.java:28)
    at q4.test.main(test.java:14)
Java Result: 1
</code></pre>

<p>have any ideas? thanks</p>
