Here you can find the source of isIntegral(String str)
public static boolean isIntegral(String str)
//package com.java2s; public class Main { public static boolean isIntegral(String str) { if (str.startsWith("-")) { if (str.length() == 1) { return false; }// w ww. j av a2 s.c om str = str.substring(1); } if ((str.startsWith("0")) && (str.length() > 1)) { return false; } return isAllCharDigit(str); } public static boolean isAllCharDigit(String str) { int length = str.length(); if (length == 0) { return false; } for (int i = 0; i < length; i++) { if (!Character.isDigit(str.charAt(i))) { return false; } } return true; } }