Java Utililty Methods Number Readable Format

List of utility methods to do Number Readable Format

Description

The list of methods to do Number Readable Format are organized into topic(s).

Method

StringtoHumanReadableNum(final Number number)
Tries to convert any number into an easily readable String representation.
String rep = number.toString();
final String signPart = rep.startsWith("-") ? "-" : "";
final String integerPart = rep.substring(signPart.length()).replaceFirst("[^0-9].*$", "");
final String restPart = rep.substring(signPart.length() + integerPart.length());
final int n = integerPart.length();
String integerPartNice = integerPart.substring(0, n % 3);
for (int i = n % 3; i < n; i += 3) {
    if (!integerPartNice.isEmpty()) {
...