Why not extract value of desired type directly from String? Check the API for valueOf(String s) method (depending on type of the value you want to get from string it might be in Integer, Double, ..., class).
Edit: Avoid comparing Strings with '==' oparator. Use equals() instead.
The quieter you are, the more you are able to hear.