List of utility methods to do Decimal Format
String | getTwoPoint(double val) get Two Point DecimalFormat nf = new DecimalFormat("0.00"); return nf.format(val); |
String | getValue(double value) Gets the value. if (isNotSet(value)) { return ""; return format(value); |
boolean | isDouble(String _str) Checks if the given string is a valid double (including negative values). return isDouble(_str, true);
|
boolean | isLikelyDouble(long value) is Likely Double if (value == canonicalDoubleNaN || value == maxDouble || value == piDouble || value == eDouble) { return true; if (value == Long.MAX_VALUE || value == Long.MIN_VALUE) { return false; double doubleValue = Double.longBitsToDouble(value); if (Double.isNaN(doubleValue)) { ... |
double | isprime(double x) isprime if ((Math.round(x) != toFix(x, 12)) || (x < 2)) { throw new IllegalArgumentException("isPrime(n), where n >= 2 is an integer"); } else { long n = Math.round(x); for (long i = 2; i <= Math.sqrt(n); i++) { double factor = n * 1.0 / i; if (Math.round(factor) == toFix(factor, 12)) return 0; ... |
boolean | isValidDouble(String value, int decimals) Tell whether a double string is in valid format, according with a number of fraction digits. DecimalFormat df; df = (DecimalFormat) DecimalFormat.getInstance(Locale.getDefault()); DecimalFormatSymbols dsym = df.getDecimalFormatSymbols(); char decSepar = dsym.getDecimalSeparator(); if (value == null || value.trim().equals("")) return true; value = value.trim(); if (value.indexOf(decSepar) != value.lastIndexOf(decSepar)) ... |
String | Julian_Cal(double JDN) Julia Cal int D, Y, M; double N1, N2, Y1, M1; N1 = (JDN - 1721119.0) + 2.0; Y1 = Math.floor((N1 - 0.2) / 365.25); N2 = N1 - Math.floor(365.25 * Y1); M1 = Math.floor((N2 - 0.5) / 30.6); D = (int) (N2 - 30.6 * M1 + 0.5); ... |
String | listToString(List list To String if (list.isEmpty()) { return "[]"; StringBuilder str = new StringBuilder(); str.append("[").append(formatDouble(list.get(0))); for (int i = 1; i < list.size(); i++) { str.append(", ").append(formatDouble(list.get(i))); str.append("]"); return str.toString(); |
String | numToString(double num) Format an integer to a string (adding commas) return numToString(num, 0);
|
String | pad(double n) pad return formatter.format(n);
|