Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static boolean isNumber(String s) {
        char ch;
        int id, len;
        boolean valid = true;

        len = s.length();
        for (int i = 0; i < len; i++) {
            ch = s.charAt(i);
            if (!(Character.isDigit(ch) || ch == '-' || ch == '+' || ch == '.'))
                return false;
        }

        return true;
    }
}