Here you can find the source of numberToPrimitiveLong(Object o)
public static long numberToPrimitiveLong(Object o) throws Exception
//package com.java2s; //License from project: Apache License public class Main { public static long numberToPrimitiveLong(Object o) throws Exception { long i;/*from www . j a v a2s .c o m*/ if (o instanceof Long) i = ((Long) o).longValue(); else if (o instanceof Integer) i = ((Integer) o).longValue(); else if (o instanceof Short) i = ((Short) o).longValue(); else if (o instanceof Byte) i = ((Byte) o).longValue(); else throw new Exception("Unknown integer type: " + o.getClass()); return i; } }