List of usage examples for java.lang Double valueOf
@HotSpotIntrinsicCandidate public static Double valueOf(double d)
From source file:Main.java
public static double roundTwoDecimals(double d) { try {//w w w . j a va 2 s . c om DecimalFormat twoDForm = new DecimalFormat("#.##"); return Double.valueOf(twoDForm.format(d)); } catch (NumberFormatException nfe) { Log.d("nfe", nfe.toString()); try { int i = (int) (d * 100); d = (i / 100); return d; } catch (NumberFormatException ne) { return d; } } }
From source file:Main.java
/** * A generic method to get the double value from a string type. * * @param s/*from w w w. ja v a2 s . c o m*/ * @return double */ public static double getDoubleValue(String s) { return (isNullOrEmpty(s) ? 0.0 : Double.valueOf(s)); }
From source file:Main.java
public static double caterpillarFormula1() { double rs = 0; double h2 = Double.valueOf(DATA_MAP.get("h2")); rs = h2 + 0.100;/*from w w w.ja v a2s.co m*/ return rs; }
From source file:Main.java
public static long sizeFromMToLong(String sizeString) { long size = 0; if (sizeString.endsWith("M")) { sizeString = sizeString.substring(0, sizeString.length() - 1); size = (long) ((Double.valueOf(sizeString)) * 1024 * 1024); } else if (sizeString.endsWith("K")) { sizeString = sizeString.substring(0, sizeString.length() - 1); size = (long) ((Double.valueOf(sizeString)) * 1024); }//w ww . j a va 2 s . com return size; }
From source file:Main.java
public static Double sub(Double v1, Double v2) { BigDecimal b1 = new BigDecimal(v1.toString()); BigDecimal b2 = new BigDecimal(v2.toString()); return Double.valueOf(b1.subtract(b2).doubleValue()); }
From source file:Main.java
public static Double add(Double v1, Double v2) { BigDecimal b1 = new BigDecimal(v1.toString()); BigDecimal b2 = new BigDecimal(v2.toString()); return Double.valueOf(b1.add(b2).doubleValue()); }
From source file:Main.java
public static Double mul(Double v1, Double v2) { BigDecimal b1 = new BigDecimal(v1.toString()); BigDecimal b2 = new BigDecimal(v2.toString()); return Double.valueOf(b1.multiply(b2).doubleValue()); }
From source file:Main.java
public static double crin1Formula4() { double rs = 0; double h9 = Double.valueOf(DATA_MAP.get("h9")); rs = h9 - CRIN1_NL;//from w w w . j a v a 2 s . c o m return rs; }
From source file:Main.java
public static double crin2Formula5() { double rs = 0; double h11 = Double.valueOf(DATA_MAP.get("h11")); rs = h11 - CRIN2_NL;//w w w. j a v a 2 s .c o m return rs; }
From source file:Main.java
public static double crin1Formula5() { double rs = 0; double h1 = Double.valueOf(DATA_MAP.get("h1")); double h10 = Double.valueOf(DATA_MAP.get("h10")); rs = h1 - (h10 - CRIN1_NF / 35.9);//from w ww .j av a 2s . c om return rs; }