Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import org.w3c.dom.*;

public class Main {
    public static final int ERROR = 1;
    private static int lastState;

    public static void setDoubleAttribute(Element node, String attr, double value) {
        try {
            node.setAttribute(attr, doubleToString(value));
            //node.setAttribute( attr, Double.toString( value ) );
        } catch (NumberFormatException ex) {
            lastState = ERROR;
        }
    }

    public static String doubleToString(double value) {
        return Double.toString(Math.floor(value * 10000.0 + 0.5) / 10000.0);
    }
}