Here you can find the source of toLong(Object obj)
public static long toLong(Object obj)
//package com.java2s; /*L// w w w . j ava 2 s .co m * Copyright Georgetown University, Washington University. * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/cab2b/LICENSE.txt for details. */ public class Main { public static long toLong(Object obj) { long value = 0; if (obj != null) { String objVal = String.valueOf(obj); if (objVal.length() > 0) { Long intObj = Long.parseLong(objVal); value = intObj.longValue(); } } return value; } }