Here you can find the source of toLong(Object num, long defValue)
public static long toLong(Object num, long defValue)
//package com.java2s; //License from project: LGPL public class Main { public static long toLong(Object num, long defValue) { if (num != null) { String value = String.valueOf(num); try { return Long.parseLong(value); } catch (Exception e) { }//from w ww . j a va 2s . c om } return defValue; } }