Here you can find the source of toLong(Object expectInt)
public static Long toLong(Object expectInt)
//package com.java2s; //License from project: Apache License public class Main { public static Long toLong(Object expectInt) { if (expectInt != null) { try { return ((Number) expectInt).longValue(); } catch (ClassCastException e) { if (expectInt instanceof String) { try { return Long.parseLong((String) expectInt); } catch (NumberFormatException e1) { }/*from w w w. j av a 2s. c o m*/ } return null; } } return null; } }