List of usage examples for java.lang Double valueOf
@HotSpotIntrinsicCandidate public static Double valueOf(double d)
From source file:Main.java
protected static String format(String value) { Double myNumber = Double.valueOf(value); NumberFormat format = NumberFormat.getInstance(); format.setMinimumFractionDigits(3);/*from w w w . j a v a 2 s . c o m*/ format.setMaximumFractionDigits(3); format.setGroupingUsed(false); return format.format(myNumber); }
From source file:Main.java
public static double sub(double value1, double value2) { BigDecimal b1 = new BigDecimal(Double.valueOf(value1)); BigDecimal b2 = new BigDecimal(Double.valueOf(value2)); return b1.subtract(b2).doubleValue(); }
From source file:Main.java
public static double mul(double value1, double value2) { BigDecimal b1 = new BigDecimal(Double.valueOf(value1)); BigDecimal b2 = new BigDecimal(Double.valueOf(value2)); return b1.multiply(b2).doubleValue(); }
From source file:Main.java
public static String randomCode(int length) { int seed = Double.valueOf(Math.pow(10, length)).intValue(); return String.format("%0" + length + "d", (r.nextInt(seed))); }
From source file:Main.java
protected static double mGetDoubleValueOf(String pVal) { if (pVal == null || pVal.isEmpty()) return 0; return Double.valueOf(pVal); }
From source file:Main.java
public static void staticMethod() { Integer intObj1 = Integer.valueOf(100); Integer intObj2 = Integer.valueOf("2014"); Double doubleObj1 = Double.valueOf(10.45); Double doubleObj2 = Double.valueOf("234.56"); Character charObj1 = Character.valueOf('A'); }
From source file:Main.java
public static double format2(double input) { DecimalFormat df = new DecimalFormat("#.00"); return Double.valueOf(df.format(input)); }
From source file:Main.java
public static double toDouble(Object srcStr, double defaultValue) { try {// w w w . j ava2s .c o m if (srcStr != null) { return Double.valueOf(srcStr.toString().replaceAll(",", "")); } } catch (Exception e) { ; } return defaultValue; }
From source file:Main.java
public static Double diff(Double d1, Double d2) { if (d1 == null) d1 = Double.valueOf(0); if (d2 == null) d2 = Double.valueOf(0);/*from ww w .j a v a 2 s . c om*/ return d1 - d2; }
From source file:Main.java
public static boolean isDouble(String str) { try {/*from ww w. ja v a 2 s.c o m*/ Double.valueOf(str); return true; } catch (Exception e) { } return false; }