Here you can find the source of toLong(Object obj)
static Long toLong(Object obj)
//package com.java2s; public class Main { static Long toLong(Object obj) { if (obj instanceof String) return Long.parseLong((String) obj); if (obj instanceof Byte) { Byte b = (Byte) obj; return b.longValue(); }/*from www .j av a2 s .c o m*/ if (obj instanceof Short) { Short s = (Short) obj; return s.longValue(); } if (obj instanceof Integer) { Integer i = (Integer) obj; return i.longValue(); } return (Long) obj; } }