private static String convertDoubleElementToString(Double value) {
        String valueToPrint = String.valueOf(value);
        if (valueToPrint.length() > ROUNDING_LENGTH) {
            int lengthBeforeDot = (int) Math.ceil(Math.log10(Math.abs(value)));
            BigDecimal bigDecimal = new BigDecimal(value);
            bigDecimal = bigDecimal.setScale(ACCURACY - lengthBeforeDot, BigDecimal.ROUND_HALF_UP);
            valueToPrint = String.valueOf(bigDecimal.doubleValue());
        }
        valueToPrint = trimZerosFromEnd(valueToPrint);
        return valueToPrint;
    }
private static String convertDoubleElementToString ( Double value ) { String valueToPrint = String . valueOf ( value ) ; if ( valueToPrint . length ( ) > ROUNDING_LENGTH ) { int lengthBeforeDot = ( int ) Math . ceil ( Math . log10 ( Math . abs ( value ) ) ) ; BigDecimal bigDecimal = new BigDecimal ( value ) ; bigDecimal = bigDecimal . setScale ( ACCURACY - lengthBeforeDot , BigDecimal . ROUND_HALF_UP ) ; valueToPrint = String . valueOf ( bigDecimal . doubleValue ( ) ) ; } valueToPrint = trimZerosFromEnd ( valueToPrint ) ; return valueToPrint ; }
The function to convert a double value into a string. If the text presentation of the double is longer
than {@link DataWriterUtil#ROUNDING_LENGTH}, the rounded off value of the double includes
the {@link DataWriterUtil#ACCURACY} number of digits from the first non-zero value.

@param value the input numeric value to convert.
@return the string with the text presentation of the input numeric value.