Java Utililty Methods Double Number Truncate

List of utility methods to do Double Number Truncate

Description

The list of methods to do Double Number Truncate are organized into topic(s).

Method

doubletruncateToTwoDecimals(double value)
Truncate double value to 2 decimal places
return value;
StringtruncDouble(double val)
trunc Double
return String.valueOf(val).replaceAll("0+$", "").replaceAll("\\.$", "");
doubletruncDouble(Double value, int decimals)
Receive a double value and trunc decimals places
char[] charValue = value.toString().toCharArray();
if (value.toString().contains("E")) {
    return value;
StringBuilder buffer = new StringBuilder(charValue.length);
int position = 0;
while (charValue[position] != '.') {
    buffer.append(charValue[position]);
...