Here you can find the source of doubleToLong(double d)
public static Long doubleToLong(double d)
//package com.java2s; //License from project: LGPL public class Main { public static Long doubleToLong(double d) { if (d >= Long.MIN_VALUE && d <= Long.MAX_VALUE) { return (long) d; }// w w w.ja v a2s . c o m return null; } public static long doubleToLong(double d, long defaultValue) { if (d >= Long.MIN_VALUE && d <= Long.MAX_VALUE) { return (long) d; } return defaultValue; } }