PUBLIC OBJECT

Champagne Floats

Suppose you've got a string that contains a floating point number: "3.5" or "2.5E-3". Your goal is to get a float from that number. There are a few different techniques to try...

If you're familiar with parseDouble(), you could use that and then cast:

    String s = ...;
    float a = (float) Double.parseDouble(s);`</pre>
Or you could save some bits and parse directly using [parseFloat()](http://developer.android.com/reference/java/lang/Float.html#parseFloat(java.lang.String)):
<pre class="prettyprint">`    String s = ...;
    float b = Float.parseFloat(s);

Do the two mechanisms yield the same result?

Ponder the problem, and when you're ready you can read my analysis in the comments...