public static double toDouble( String str, double def ) {
    double retval;
    if ( str == null ) {
      retval = def;
    } else {
      try {
        retval = Double.parseDouble( str );
      } catch ( Exception e ) {
        retval = def;
      }
    }
    return retval;
  }
@Test
  public void testToDouble() {
    Assert.assertEquals( 123.45, Const.toDouble( "123.45", -12.34 ), 1e-15 );
    Assert.assertEquals( -12.34, Const.toDouble( "123asd", -12.34 ), 1e-15 );
    Assert.assertEquals( -12.34, Const.toDouble( "", -12.34 ), 1e-15 );
    Assert.assertEquals( -12.34, Const.toDouble( null, -12.34 ), 1e-15 );
  }