public static String numberToString(Number number) throws JSONException {
  if (number == null) {
    throw new JSONException("Null pointer");
  }
  testValidity(number);
  String string=number.toString();
  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;
}

public static String numberToString ( Number number ) throws JSONException { if ( number == null ) { throw new JSONException ( "Null pointer" ) ; } testValidity ( number ) ; String string = number . toString ( ) ; 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 number .
