List of utility methods to do Fraction Format
String | formatAnotherString(double valor) format Another String DecimalFormat format = new DecimalFormat("#,##0.00"); return format.format(valor); |
String | formataNum(double numero) formata Num return formataNum(numero, "0.##"); |
double | formatAvgTime(double avg) format Avg Time String avgTime; if (avg < 0.01) { avgTime = new DecimalFormat(",000").format(avg); } else if (avg < 0.1) { avgTime = new DecimalFormat(",00").format(avg); } else { avgTime = new DecimalFormat(".").format(avg); return Double.parseDouble(avgTime); |
String | formatBet(Double betOdd, int formatterDigits) Format bet. configureFormatter(formatterDigits);
return DECIMAL_FORMATTER.format(betOdd);
|
String | formatBetHandicap(Double handicap) Format bet handicap. configureFormatterHandicap(); String result; String handicapStr = HANDICAP_FORMATTER.format(handicap); if (handicap > 0) { result = new StringBuffer("+").append(handicapStr).toString(); } else if (handicap < 0) { result = handicapStr; } else { ... |
String | formatBytes(final double bytes) Formats the given number of bytes into an easily readable format String scaledY; if (bytes < 10000) { scaledY = BYTES_FORMAT.format((long) bytes) + " B"; } else if (bytes <= 500 * 1024) { scaledY = BYTES_FORMAT.format(bytes / 1024) + " KB"; } else { scaledY = MB_FORMAT.format(((float) bytes / (1024 * 1024))) + " MB"; return scaledY; |
String | formatCoordinates(double lat, double lon) Return text representation of coordinates. String r = ""; DecimalFormatSymbols symbols = new DecimalFormatSymbols(); symbols.setDecimalSeparator('.'); symbols.setGroupingSeparator(' '); DecimalFormat df = new DecimalFormat("#.00000", symbols); r = "(" + df.format(lat) + ", " + df.format(lon) + ")"; return r; |
String | formatCPUUtilization(double d) format CPU Utilization DecimalFormat decimalFormat = new DecimalFormat("0.00"); if (d < 0) { return "NA"; } else { return decimalFormat.format(d * 100).replace(",", "."); |
String | formatD(double d) Format as double return nf.format(d);
|
String | formatData(double aAmount) Format the amount of data in bytes to a nice readable string DecimalFormat df = new DecimalFormat("#,###,###.##"); String type = ""; double niceDataDown = 0; double dataDown = aAmount; if (dataDown < 1024) { niceDataDown = dataDown; type = " bytes"; } else if ((dataDown / 1024) < 1024) { ... |