Java parse a number in exponential notation
<p>I am trying to do a conversion of a String to integer for which I get a <code>NumberFormatException</code>. The reason is pretty obvious. But I need a workaround here. Following is the sample code.</p>

<pre><code>public class NumberFormatTest {
 public static void main(String[] args) {
  String num = "9.18E+09";
  try{
   long val = Long.valueOf(num);
  }catch(NumberFormatException ne){
   //Try to convert the value to 9180000000 here
  }
 }
}
</code></pre>

<p>I need the logic that goes in the comment section, a generic one would be nice. Thanks.</p>
