I need to format a double value without any precision
It can have 13 digits to the left of decimal and 6 digits right side of decimal.
I used
public static String formatDouble(double dNumber) {
DecimalFormat dcf = new DecimalFormat("##################0.000000");
String sformattedDouble = dcf.format(dNumber);
return sformattedDouble;
}
Now the problem is that the DecimalFormat class uses ROUND_HALF_EVEN rounding, which I do not want to use.
Should I be using some other data type(like BigDecimal) instead as the numbers I am dealing with are pertaining to currency values so I can not use precision ?
Any suggestion will be great.