title: Encountering NumberFormatException
body: <p>I am trying to convert a string to a double but get a NumberFormatException.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>String x = "";
  // String ary[]=new String[10];
  while (finalstr.charAt(stpr) != ' ') {
      // System.out.print(finalstr.charAt(stpr));
      Character c = new Character(finalstr.charAt(stpr));
  
      String s = c.toString(c);
      ary[i] = s;
      x = x + ary[i];
      i++;
  
      stpr++;
      // first++;
  }
  // System.out.print(x);
  String yo = x;
  // System.out.print(yo); //it prints well
  // double d = Double.valueOf(yo.trim()).doubleValue();
  double doubleprim = Double.parseDouble(yo);
  System.out.print(doubleprim);
  </code></pre>
  
  <p>All help appreciated.</p>