code: private String convertDecimal(double d, String format)
      {
          String ret = "";
  
          if(format.length() > 0)
          {
              DecimalFormat f = new DecimalFormat(format);
              ret = f.format(d);
          }
          else
          {
              ret = Double.toString(d);
          }
  
          return ret;
      }
docs: Converts the given numeric value to the output date format.
  @param d The value to be converted
  @param format The format to use for the value
  @return The formatted value