title: Parse a negative prefix integer from string in java
body: <p>Hi i have a string looking something like this 10 -1 30 -2 and i want to read the numbers between spaces. I can do this using a FOR statement and the code </p>
  
  <pre><code>Character.toString(myString.charAt(i));
  </code></pre>
  
  <p>and</p>
  
  <pre><code>Integer.parseInt(myString);
  </code></pre>
  
  <p>But i face a problem when i try to read negative number like -1 and i got the error message:</p>
  
  <pre><code>09-09 13:06:49.630: ERROR/AndroidRuntime(3365): Caused by: java.lang.NumberFormatException: unable to parse '-' as integer
  </code></pre>
  
  <p>Any ideas how to solve this ??</p>