code: public static Long toLong(Object o, Long defaultValue) {
  	if (o instanceof Long) return (Long) o;
  	if (defaultValue != null) return Long.valueOf(toLongValue(o, defaultValue.longValue()));
  
  	long res = toLongValue(o, Long.MIN_VALUE);
  	if (res == Long.MIN_VALUE) return defaultValue;
  	return Long.valueOf(res);
      }
docs: cast a Object to a Long Object(reference type)
  
  @param o Object to cast
  @param defaultValue
  @return casted Long Object