code: public static long parseLong(final String str, final long def) {
          final Long ret = parseLong(str);
          if (ret == null) {
              return def;
          } else {
              return ret.longValue();
          }
      }
docs: Parses a long out of a string.
  
  @param str string to parse for a long.
  @param def default value to return if it is not possible to parse the the string.
  @return the long represented by the given string, or the default.