Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * Determine if the current s is an integer or not
     * 
     * @param s
     * @return
     */
    public static boolean isInteger(String s) {
        if (s == null || s.length() == 0)
            return false;
        for (int i = 0; i < s.length(); i++) {
            if (i == 0 && s.charAt(i) == '-')
                continue;
            if (s.charAt(i) > '9' || s.charAt(i) < '0')
                return false;
        }
        return true;
    }
}