Java Double to Long doubleToLong(double d)

Here you can find the source of doubleToLong(double d)

Description

double To Long

License

LGPL

Declaration

public static Long doubleToLong(double d) 

Method Source Code

//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;
    }
}

Related

  1. doubleToLong(Double aVal)
  2. doubleToLong(double[] values)
  3. doubleToLong(final double d)
  4. DoubleToLong_With_Little_Endian(double dd)
  5. doubleToLongArray(final double value)