I need to convert double to string with given precision. String.format(\"%.3f\", value) (or DecimalFormat) does the job but benchmarks show that it slow even in com
String.format(\"%.3f\", value)
I haven't benchmarked this, but how about using BigDecimal?
BigDecimal bd = new BigDecimal(value).setScale(3, RoundingMode.HALF_UP); return bd.toString();