List of utility methods to do Decimal Format
String | getProgressExact(double balance, double cost) get Progress Exact double percent = 100.0D * balance / cost; if (percent >= 100.0D) { return "100"; if (percent < 0.0D) { return "0"; String format = format(percent); ... |
String | getRealEye(double eye) get Real Eye DecimalFormat df = new DecimalFormat("#.##"); if (eye == 3.9) { return "0.08"; } else if (eye == 3.8) { return "0.06"; } else if (eye == 3.7) { return "0.04"; } else if (eye == 3.6) { ... |
double | getRedondeoHaciaArriba(double pTotal) get Redondeo Hacia Arriba if (pTotal > 0.00) { String myTotal = formatNumber(pTotal); int myRedondeo = Integer.parseInt(myTotal.substring(myTotal.length() - 1, myTotal.length())); if (myRedondeo > 5) { return (0.01 * (10 - myRedondeo)); } else if (myRedondeo > 0) { return (0.01 * (5 - myRedondeo)); } else { ... |
String | getScientificNotation(double value) get Scientific Notation NumberFormat formatter = new DecimalFormat("0.0E0"); formatter.setRoundingMode(RoundingMode.HALF_UP); formatter.setMinimumFractionDigits(NUMBER_DECIMAL_PLACES); return formatter.format(value); |
String | getSpaceMessage(final double bytes) get Space Message if (bytes < (KILO * 0.8)) { return bytes + "B"; if (bytes < (MEGA * 0.8)) { final double kilos = bytes / KILO; return SPACE_FORMAT.format(kilos) + "kB"; if (bytes < (GIGA * 0.8)) { ... |
String | getStandardDeviationString(double[] standardDeviationDoubles) get Standard Deviation String if (standardDeviationDoubles == null) { return null; StringBuilder standardDeviationString = new StringBuilder(standardDeviationDoubles.length * 9); DecimalFormat exponentialFormat = new DecimalFormat("0.0#E0"); DecimalFormat decimalFormat = new DecimalFormat("0.0#"); boolean first = true; for (double standardDeviationDouble : standardDeviationDoubles) { ... |
String | getStandardDouble(double d, int pL) get Standard Double String format = "0."; for (int i = 0; i < pL; i++) format += "0"; return ((new DecimalFormat(format)).format(d)); |
String | getString(Double d) get String NumberFormat nf = NumberFormat.getInstance();
nf.setGroupingUsed(false);
return nf.format(d);
|
String | getStringFromDouble(double number) get String From Double DecimalFormat df = new DecimalFormat("#.###"); return df.format(number); |
String | getStringRepresentationForDouble(double value) Returns the string representation of a double value which can be used in a DML script. NumberFormat nf = DecimalFormat.getInstance(new Locale("EN")); nf.setGroupingUsed(false); nf.setMinimumFractionDigits(1); nf.setMaximumFractionDigits(20); return nf.format(value); |