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 {
    /**
     * Parses the given attribute of this tag as a hexadecimal encoded string and
     * returns it as an int
     */
    public static int getAttribIntHex(Element ele, String name) {
        String sval = ele.getAttribute(name);
        int val = 0;
        try {
            val = Integer.parseInt(sval, 16);
        } catch (Exception e) {
        }

        return val;
    }

    public static int parseInt(String val) {
        if (val == null)
            return 0;

        int retVal = 0;
        try {
            retVal = Integer.parseInt(val);
        } catch (Exception e) {
        }
        return retVal;
    }
}