Here you can find the source of isNumericAndCanNull(String src)
public static boolean isNumericAndCanNull(String src)
//package com.java2s; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main { public static boolean isNumericAndCanNull(String src) { Pattern numericPattern = Pattern.compile("^[0-9]+$"); if ((src == null) || (src.equals(""))) return true; boolean return_value = false; if ((src != null) && (src.length() > 0)) { Matcher m = numericPattern.matcher(src); if (m.find()) return_value = true; }//from w w w .jav a2 s .com return return_value; } public static boolean equals(String s1, String s2) { if ((isEmpty(s1)) && (isEmpty(s2))) return true; if ((!(isEmpty(s1))) && (!(isEmpty(s2)))) return s1.equals(s2); return false; } public static boolean isEmpty(String s) { return ((s == null) || ("".equals(s))); } public static String isEmpty(String s, String result) { if ((s != null) && (!(s.equals("")))) return s; return result; } }