static protected String doubleToString(double d){
  if (Double.isInfinite(d) || Double.isNaN(d)) {
    return "null";
  }
  String string=Double.toString(d);
  if (string.indexOf('.') > 0 && string.indexOf('e') < 0 && string.indexOf('E') < 0) {
    while (string.endsWith("0")) {
      string=string.substring(0,string.length() - 1);
    }
    if (string.endsWith(".")) {
      string=string.substring(0,string.length() - 1);
    }
  }
  return string;
}

static protected String doubleToString ( double d ) { if ( Double . isInfinite ( d ) || Double . isNaN ( d ) ) { return "null" ; } String string = Double . toString ( d ) ; if ( string . indexOf ( '.' ) > 0 && string . indexOf ( 'e' ) < 0 && string . indexOf ( 'E' ) < 0 ) { while ( string . endsWith ( "0" ) ) { string = string . substring ( 0 , string . length ( ) - 1 ) ; } if ( string . endsWith ( "." ) ) { string = string . substring ( 0 , string . length ( ) - 1 ) ; } } return string ; }
produce a string from a double . the string " null " will be returned if the number is not finite .
