public static double asDouble(String str,double def){
  try {
    return Double.parseDouble(str);
  }
 catch (  NumberFormatException e) {
    return def;
  }
}

public static double asDouble ( String str , double def ) { try { return Double . parseDouble ( str ) ; } catch ( NumberFormatException e ) { return def ; } }
parse string to double , if string can ' t be parsed to double , then it will return given default value .
