public static String toString3 ( double d ) { long l = ( long ) d ; if ( l == d ) return toString ( l ) ; String str = Double . toString ( d ) ; int pos ; if ( ( pos = str . indexOf ( ' ' ) ) != - 1 && pos == str . length ( ) - 2 ) { return new StringBuffer ( pos + 2 ) . append ( str . charAt ( 0 ) ) . append ( str . substring ( 2 , toDigit ( str . charAt ( pos + 1 ) ) + 2 ) ) . append ( ' ' ) . append ( str . substring ( toDigit ( str . charAt ( pos + 1 ) ) + 2 , pos ) ) . toString ( ) ; } return str ; }
cast a double value to a String