public static String double2str ( final double doubleValue , final int radix ) { if ( radix != 10 && radix != 16 ) { throw new IllegalArgumentException ( "Illegal radix [" + radix + ' ' ) ; } final String result ; if ( radix == 16 ) { String converted = Double . toHexString ( doubleValue ) ; boolean minus = converted . startsWith ( "-" ) ; if ( minus ) { converted = converted . substring ( 1 ) ; } if ( converted . startsWith ( "0x" ) ) { converted = converted . substring ( 2 ) ; } result = ( minus ? ' ' + converted : converted ) . toUpperCase ( Locale . ENGLISH ) ; } else { result = Double . toString ( doubleValue ) ; } return result ; }
Convert double value into string representation with defined radix base .