Java tutorial
//package com.java2s; public class Main { public static float getValueByFloat(String value) { float result = 0; if (value != null && !value.equals("")) { try { result = Float.valueOf(value); } catch (NumberFormatException e) { } } return result; } }