Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.ArrayList;

import java.util.List;

import org.w3c.dom.Node;

public class Main {
    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));
            }
            n = n.getNextSibling();
        }
        return measureValues.toArray(new Double[0]);
    }
}