List of usage examples for java.lang Double toString
public String toString()
From source file:com.wms.utils.DataUtil.java
public static Long convertDoubleToLong(Double value) { return value == null ? 0L : Long.parseLong(value.toString().replace(".0", "")); }
From source file:com.nridge.core.base.std.StrUtl.java
/** * Convenience method that converts a generic ArrayList of * Objects into an array of string values. * * @param anArrayList Array of value object instances. * * @return An array of values extracted from the array list. *//*from w ww. j a v a 2 s . c o m*/ public static String[] convertToMulti(ArrayList<?> anArrayList) { if ((anArrayList == null) || (anArrayList.size() == 0)) { String[] emptyList = new String[1]; emptyList[0] = StringUtils.EMPTY; return emptyList; } int offset = 0; String[] multiValues = new String[anArrayList.size()]; for (Object arrayObject : anArrayList) { if (arrayObject instanceof Integer) { Integer integerValue = (Integer) arrayObject; multiValues[offset++] = integerValue.toString(); } else if (arrayObject instanceof Long) { Long longValue = (Long) arrayObject; multiValues[offset++] = longValue.toString(); } else if (arrayObject instanceof Float) { Float floatValue = (Float) arrayObject; multiValues[offset++] = floatValue.toString(); } else if (arrayObject instanceof Double) { Double doubleValue = (Double) arrayObject; multiValues[offset++] = doubleValue.toString(); } else if (arrayObject instanceof Date) { Date dateValue = (Date) arrayObject; multiValues[offset++] = Field.dateValueFormatted(dateValue, Field.FORMAT_DATETIME_DEFAULT); } else multiValues[offset++] = arrayObject.toString(); } return multiValues; }
From source file:com.ecofactor.qa.automation.dao.util.DataUtil.java
/** * Prints the spo job data json.//from w w w . jav a2s .c om * @param jsonArray the json array */ public static void printSPOJobDataJson(JSONArray jsonArray) { DriverConfig.setLogString("Json Grid", true); DriverConfig.setLogString( "=============================================================================================================================", true); DriverConfig.setLogString( "| Start Time | End Time | Delta EE | MO BlackOut | MO Cuttoff | MO Recovery |", true); DriverConfig.setLogString( "=============================================================================================================================", true); int loopVal = 0; for (int i = 0; i < jsonArray.length(); i++) { try { if (loopVal != 0) { DriverConfig.setLogString( "=============================================================================================================================", true); } JSONObject jsonObj = jsonArray.getJSONObject(i); String startCal = (String) jsonObj.get("start"); String endcal = (String) jsonObj.get("end"); Double deltaEE = (Double) jsonObj.get("deltaEE"); Integer moBlackOut = (Integer) jsonObj.get("moBlackOut"); String moCutoff = (String) jsonObj.get("moCutoff"); Double moRecovery = (Double) jsonObj.get("moRecovery"); DriverConfig.setLogString( "| " + addSpace(startCal, 26) + "| " + addSpace(endcal, 25) + "| " + addSpace(deltaEE.toString(), 11) + "| " + addSpace(moBlackOut.toString(), 14) + "| " + addSpace(moCutoff, 25) + "| " + addSpace(moRecovery.toString(), 12) + "|", true); loopVal++; } catch (JSONException e) { e.printStackTrace(); } } DriverConfig.setLogString( "=============================================================================================================================", true); }
From source file:com.ecofactor.qa.automation.dao.util.DataUtil.java
/** * Prints the utcspo job data json.//from w w w.j a va 2 s .co m * @param jsonArray the json array * @param timeZone the time zone */ public static void printUTCSPOJobDataJson(JSONArray jsonArray, String timeZone) { DriverConfig.setLogString("Json Grid", true); DriverConfig.setLogString( "=============================================================================================================================", true); DriverConfig.setLogString( "| Start Time | End Time | Delta EE | MO BlackOut | MO Cuttoff | MO Recovery |", true); DriverConfig.setLogString( "=============================================================================================================================", true); int loopVal = 0; for (int i = 0; i < jsonArray.length(); i++) { try { if (loopVal != 0) { DriverConfig.setLogString( "=============================================================================================================================", true); } JSONObject jsonObj = jsonArray.getJSONObject(i); String startCal = (String) jsonObj.get("start"); String endcal = (String) jsonObj.get("end"); Double deltaEE = (Double) jsonObj.get("deltaEE"); Integer moBlackOut = (Integer) jsonObj.get("moBlackOut"); String moCutoff = (String) jsonObj.get("moCutoff"); Double moRecovery = (Double) jsonObj.get("moRecovery"); DriverConfig.setLogString( "| " + addSpace(startCal, 26) + "| " + addSpace(endcal, 25) + "| " + addSpace(deltaEE.toString(), 11) + "| " + addSpace(moBlackOut.toString(), 14) + "| " + addSpace(moCutoff, 25) + "| " + addSpace(moRecovery.toString(), 12) + "|", true); loopVal++; } catch (JSONException e) { e.printStackTrace(); } } DriverConfig.setLogString( "=============================================================================================================================", true); }
From source file:com.ecofactor.qa.automation.dao.util.DataUtil.java
/** * Prints the spo job data json.// ww w. j ava2 s .co m * @param jsonArray the json array */ public static void printMockSPOJobDataJson(JSONArray jsonArray) { DriverConfig.setLogString("Json Grid", true); DriverConfig.setLogString( "=============================================================================================================================", true); DriverConfig.setLogString( "| Start Time | End Time | Delta EE | MO BlackOut | MO Cuttoff | MO Recovery |", true); DriverConfig.setLogString( "=============================================================================================================================", true); int loopVal = 0; for (int i = 0; i < jsonArray.length(); i++) { try { if (loopVal != 0) { DriverConfig.setLogString( "=============================================================================================================================", true); } JSONObject jsonObj = jsonArray.getJSONObject(i); String startCal = (String) jsonObj.get("start"); String endCal = (String) jsonObj.get("end"); Double deltaEE = (Double) jsonObj.get("deltaEE"); Integer moBlackOut = (Integer) jsonObj.get("moBlackOut"); String moCutoff = (String) jsonObj.get("moCutoff"); Integer moRecovery = (Integer) jsonObj.get("moRecovery"); DriverConfig.setLogString( "| " + addSpace(startCal, 26) + "| " + addSpace(endCal, 25) + "| " + addSpace(deltaEE.toString(), 11) + "| " + addSpace(moBlackOut.toString(), 14) + "| " + addSpace(moCutoff, 25) + "| " + addSpace(moRecovery.toString(), 12) + "|", true); loopVal++; } catch (JSONException e) { e.printStackTrace(); } } DriverConfig.setLogString( "=============================================================================================================================", true); }
From source file:net.ceos.project.poi.annotated.core.CellHandler.java
/** * Manage the cached formula case.//from w w w.ja v a2 s . c o m * * @param cellthe * {@link Cell} * @return the content of the cell */ private static String switchCachedFormulaManager(final Cell cell) { switch (cell.getCachedFormulaResultType()) { case Cell.CELL_TYPE_NUMERIC: Double value = cell.getNumericCellValue(); return value.toString(); case Cell.CELL_TYPE_STRING: return cell.getRichStringCellValue().toString(); default: return null; } }
From source file:net.ceos.project.poi.annotated.core.CellHandler.java
/** * Recover the value from the Excel./*from w w w. j a v a 2s . c o m*/ * * @param cell * the {@link Cell} * @return the content of the cell */ private static String readCell(final Cell cell) { if (cell == null) { return null; } if (cell.getCellType() == Cell.CELL_TYPE_STRING) { return cell.getStringCellValue(); } if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) { Double value = cell.getNumericCellValue(); return value.toString(); } if (cell.getCellType() == Cell.CELL_TYPE_FORMULA) { return switchCachedFormulaManager(cell); } return null; }
From source file:org.esupportail.papercut.domain.PayboxPapercutTransactionLog.java
public String getMontantDevise() { Double mnt = new Double(montant) / 100.0; return mnt.toString(); }
From source file:uk.ac.ebi.intact.editor.config.property.DoublePropertyConverter.java
@Override public String convertToString(Double obj) { if (obj == null) return null; return obj.toString(); }
From source file:com.balero.models.TestDAO.java
@Transactional public void add() { Session session = sessionFactory.openSession(); Test test = new Test(); Double n = Math.random(); test.setName("user_" + n.toString()); test.setEmail("user@" + n.toString()); session.save(test);/* ww w . java 2 s.c o m*/ session.flush(); session.close(); }