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 isPositiveInteger(String numStr) {
        if (isInteger(numStr)) {
            double parseDouble = Double.parseDouble(numStr);
            if (parseDouble > 0) {
                return true;
            }
        }
        return false;
    }

    public static boolean isInteger(String numStr) {
        try {
            double parseDouble = Double.parseDouble(numStr);
            return parseDouble % 1 == 0;
        } catch (Exception exception) {
            return false;
        }
    }
}