List of usage examples for java.lang Double parseDouble
public static double parseDouble(String s) throws NumberFormatException
From source file:Main.java
static public double getDoubleTextContent(Element element) { String s = getTrimmedTextContent(element); return s == null || s.isEmpty() ? 0 : Double.parseDouble(s); }
From source file:Main.java
public static Date toModifiedTimeDate(String modified) { long now = System.currentTimeMillis(); try {// ww w. j a v a2 s. c om double modDouble = Double.parseDouble(modified) * 1000; long mod = Math.round(modDouble); // Dbg.printf("mod: %d ; cur : %d ; delta : %d\n", mod, now, now - mod); return new Date(mod); } catch (Exception e) { return new Date(); // todo buggy ? } }
From source file:Main.java
public static double getValue(final Node node, final String strAttrName, final String strAttrValue, final double dDefaultValue) { final String strValue = getValue(node.getChildNodes(), strAttrName, strAttrValue); if (strValue == null) { return dDefaultValue; }// w w w .ja v a 2 s.c o m return Double.parseDouble(strValue); }
From source file:Main.java
static public double getDoubleAttribute(Element element, String name) { String s = getTrimmedAttribute(element, name); return s.isEmpty() ? 0d : Double.parseDouble(s); }
From source file:Main.java
/** * * @param node Node/*from ww w . j a va 2 s . com*/ * @param nodeName String * @param errValue double * @return double */ public static double getChildDoubleByName(Node node, String nodeName, double errValue) { String s = getChildStringByName(node, nodeName, ""); if (s.length() > 0) return Double.parseDouble(s); return errValue; }
From source file:Main.java
public static int PecentToInt(String percentValue) { percentValue = percentValue.replaceAll("%", ""); int newValue = 0; try {//from w w w . j a va2 s . c om double temp = Double.parseDouble(percentValue); newValue = Integer.parseInt(new java.text.DecimalFormat("0").format(temp)); } catch (Exception e) { } return newValue; }
From source file:Main.java
public static double PecentToDouble(String percentValue) { percentValue = percentValue.replaceAll("%", ""); double newValue = 0; try {//ww w .j av a 2 s .c o m newValue = Double.parseDouble(percentValue); } catch (Exception e) { } return newValue; }
From source file:Main.java
public static double stringToDouble(String str) { if (TextUtils.isEmpty(str)) { return 0.00; }//from ww w. j ava 2 s . c o m return round(Double.parseDouble(str)); }
From source file:Main.java
public static Date toModifiedTimeDate(String modified) { @SuppressWarnings("unused") long now = System.currentTimeMillis(); try {/*from ww w. ja v a 2 s .co m*/ double modDouble = Double.parseDouble(modified) * 1000; long mod = Math.round(modDouble); // Dbg.printf("mod: %d ; cur : %d ; delta : %d\n", mod, now, now - mod); return new Date(mod); } catch (Exception e) { return new Date(); // todo buggy ? } }
From source file:Main.java
public static ArrayList<Double> stringToDoubleList(String s, String delimeter) { String[] fields = s.split(delimeter); ArrayList<Double> ret = new ArrayList<Double>(); for (int i = 0; i < fields.length; i++) { ret.add(Double.parseDouble(fields[i].trim())); }/* ww w.j a v a 2s . c o m*/ return ret; }