From JBuilder helptry {f = Float.parseFloat(gg.trim());}catch (NumberFormatException e) {...}where gg is your string and f is your float.