Here you can find the source of tryParseLong(Object obj, Long defaultVal)
public static Long tryParseLong(Object obj, Long defaultVal)
//package com.java2s; //License from project: Apache License public class Main { public static Long tryParseLong(Object obj, Long defaultVal) { if (obj == null) return defaultVal; if (obj instanceof Long) return (Long) obj; try {/*from w w w. j a v a2 s . c om*/ String val = obj.toString(); return Long.parseLong(val); } catch (Exception e) { return defaultVal; } } }