Here you can find the source of isLong(String str)
public static boolean isLong(String str)
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean isLong(String str) { if ("0".equals(str.trim())) { return true; }/* w w w . j a v a2s . co m*/ Pattern pattern = Pattern.compile("^[^0]\\d*"); Matcher isNum = pattern.matcher(str); if (!isNum.matches()) { return false; } return true; } }