Java tutorial
//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; } } }