Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.regex.Pattern;

public class Main {
    public static boolean heightCheck(String heightStr) {
        if (heightStr == null || (heightStr.trim().equals(""))) {
            return false;
        }
        Pattern pattern = Pattern.compile("^[0-9]*$");
        if (pattern.matcher(heightStr).matches()) {
            int hei = Integer.valueOf(heightStr);
            if ((hei > 140) && (hei < 200)) {
                return true;
            } else {
                return false;
            }
        } else {
            return false;
        }
    }
}