code: public static boolean isNumber(final String num) {
      if (num == null || num.length() == 0) {
        return false;
      }
      final boolean firstIsDigit = Character.isDigit(num.charAt(0));
      if (!firstIsDigit && num.charAt(0) != '-') {
        return false;
      }
      boolean dig = firstIsDigit;
      for (int i = 1; i < num.length(); i++) {
        if (!Character.isDigit(num.charAt(i))) {
          return false;
        }
        dig = true;
      }
      return dig;
    }
docs: Check that a string is a number.
  
  @param num a string to be checked, it can be null
  @return true if the string represents a number, false if it is not number
  or it is null