code: public static long parseLong(Object val)
    {
      if (val instanceof String) {
        return Long.parseLong((String) val);
      } else if (val instanceof Number) {
        return ((Number) val).longValue();
      } else {
        if (val == null) {
          throw new NullPointerException("Input is null");
        } else {
          throw new ISE("Unknown type [%s]", val.getClass());
        }
      }
    }
docs: Parse the given object as a {@code long}. The input object can be a {@link String} or one of the implementations of
  {@link Number}. You may want to use {@code GuavaUtils.tryParseLong()} instead if the input is a nullable string and
  you want to avoid any exceptions.
  
  @throws NumberFormatException if the input is an unparseable string.
  @throws NullPointerException if the input is null.
  @throws ISE if the input is not a string or a number.