Here you can find the source of toLong(Object object)
public static Long toLong(Object object)
//package com.java2s; //License from project: Open Source License public class Main { public static Long toLong(Object object) { Long longValue;//from www . jav a 2s . c om if (object instanceof String) { longValue = (long) Integer.valueOf((String) object); } else if (object instanceof Number) { // Note: Do *not* use Number.longValue() here, since it causes a GWT exception when in non-hosted mode. longValue = (long) ((Number) object).intValue(); } else if (object == null) { longValue = null; } else { throw new IllegalArgumentException("Failed to convert " + object.getClass().getName() + " [" + object + "] to a Long."); } return longValue; } }