Java Double to Short doubleToShortBits(double d)

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

Description

Turns a double-precision floating point integer into an integer.

License

Open Source License

Parameter

Parameter Description
d The double to transform.

Return

The converted integer.

Declaration

public static int doubleToShortBits(double d) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from   w  w w  . j  a v a 2 s . c om
     * Turns a double-precision floating point integer into an integer.
     * 
     * @param d
     *            The double to transform.
     * @return The converted integer.
     */
    public static int doubleToShortBits(double d) {
        long l = Double.doubleToLongBits(d);
        return (int) (l >> 48);
    }
}

Related

  1. doubleToShort(double d)
  2. doubleToShort(double[] values)
  3. doubleToShort(final double value)