Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    static int getServiceVersionNumberInternal(String version) {
        if (!version.equals("@" + "version" + "@")) {
            try {
                int firstDot = version.indexOf(".");
                int secondDot = version.indexOf(".", firstDot + 1);

                int p = secondDot + 1;
                int q = p;

                while (q < version.length() && Character.isDigit(version.charAt(q))) {
                    q++;
                }

                if (p != q) {
                    String service = version.substring(p, q);
                    return new Integer(service).intValue();
                }
            } catch (NumberFormatException nfe) {
            }
        }
        // in case this is a mainline version or NFE was caught (strange)
        return 0;
    }
}