List of usage examples for java.lang Double Double
@Deprecated(since = "9") public Double(String s) throws NumberFormatException
From source file:Main.java
/** * convert longitude from DMS (Degrees, Minutes, Seconds) to DD (Decimal Degrees) * * @param int longDeg - longitude degree value * @param double longMin - longitude minute value * @param double longSec - longitude second value * @param String longDir - longitude direction (west or east) * @return double - double values for given longitude *//*from w w w . j a v a2s .c om*/ public static double convertLongDMStoDD(int longDeg, int longMin, double longSec, String longDir) { double longitude = longDeg + (longMin / new Double(60)) + (longSec / new Double(3600)); if (longDir.equalsIgnoreCase("w")) longitude = -longitude; return longitude; }
From source file:Main.java
public static Double[] getDataList(Node sampleNode) { if (sampleNode == null) return new Double[0]; List<Double> measureValues = new ArrayList<Double>(); Node n = sampleNode.getFirstChild(); while (n != null) { if (n.getNodeName().equalsIgnoreCase("data")) { String ms = n.getFirstChild().getNodeValue(); double mesVal = Double.parseDouble(ms); measureValues.add(new Double(mesVal)); }// w w w . ja v a 2 s . c o m n = n.getNextSibling(); } return measureValues.toArray(new Double[0]); }
From source file:Main.java
public static Double convertDouble(String str) { double val = 0; try {/* w w w. j ava 2 s . com*/ val = Double.parseDouble(str); } catch (NumberFormatException ex) { } return new Double(val); }
From source file:Main.java
public static List<Double> asList(double[] a) { List<Double> result = new ArrayList<Double>(a.length); for (int i = 0; i < a.length; i++) { result.add(new Double(a[i])); }//from w ww . ja va 2 s . c o m return result; }
From source file:gov.nih.nci.caintegrator.application.zip.FileNameGenerator.java
public static String generateFileName(String userName) throws ValidationException { String fileName = null;//from w w w .ja va 2 s. co m if (userName != null) { // Get a random number of up to 7 digits int sevenDigitRandom = new Double(Math.random() * 10000000).intValue(); // Get the last 7 digits of the Java timestamp String s = String.valueOf(System.currentTimeMillis()); String lastSevenOfTimeStamp = s.substring(s.length() - 7, s.length()); // Put it all together fileName = userName + "_" + sevenDigitRandom + lastSevenOfTimeStamp; } else { throw new ValidationException("Invalid Email Address"); } return fileName; }
From source file:chart.PieChart_AWT.java
private static PieDataset createDataset() { DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue("IPhone 5s", new Double(20)); dataset.setValue("SamSung Grand", new Double(20)); dataset.setValue("MotoG", new Double(40)); dataset.setValue("Nokia Lumia", new Double(10)); return dataset; }
From source file:Main.java
public static int getPreferredWidth(Component comp) { return new Double(comp.getPreferredSize().getWidth()).intValue(); }
From source file:Main.java
public static int getPreferredHeight(Component comp) { return new Double(comp.getPreferredSize().getHeight()).intValue(); }
From source file:graphic.Grafico.java
private static javax.swing.JPanel pizza3D(ArrayList nome, ArrayList valor, String tituloGrafico, float transparencia, String tipo) { DefaultPieDataset data = new DefaultPieDataset(); for (int i = 0; i < nome.toArray().length; i++) { data.setValue("" + nome.get(i).toString(), new Double(valor.get(i).toString())); }//from w ww . j a va 2 s . co m JFreeChart chart = ChartFactory.createPieChart3D(tituloGrafico, data, true, true, true); java.awt.Color cor = new java.awt.Color(200, 200, 200); chart.setBackgroundPaint(cor); PiePlot3D plot = (PiePlot3D) chart.getPlot(); plot.setLabelLinksVisible(true); plot.setNoDataMessage("No existem dados para serem exibidos no grfico"); plot.setStartAngle(90); plot.setDirection(Rotation.CLOCKWISE); plot.setForegroundAlpha(transparencia); plot.setInteriorGap(0.20); ChartPanel chartPanel = new ChartPanel(chart); return chartPanel; }
From source file:Util.java
public static String parseDollars(double amount) { if (Double.isNaN(amount) || Double.isInfinite(amount)) return (new Double(amount)).toString(); return parseDollars((int) Math.round(amount)); }