Here you can find the source of numberToLong(Number n)
public static Long numberToLong(Number n)
//package com.java2s; //License from project: Apache License public class Main { public static Long numberToLong(Number n) { if (n != null && !(n instanceof Float)) { if (n instanceof Integer) return ((Integer) n).longValue(); else if (n instanceof Short) return ((Short) n).longValue(); else if (n instanceof Long) return ((Long) n).longValue(); }// ww w .j ava 2 s. com return null; } }