Java Double to doubleToIndex(final double x)

Here you can find the source of doubleToIndex(final double x)

Description

double To Index

License

Open Source License

Declaration

static int doubleToIndex(final double x) 

Method Source Code

//package com.java2s;
/*/*from  w  w  w . java  2 s . c o m*/
 * Copyright (c) 2014. Real Time Genomics Limited.
 *
 * Use of this source code is bound by the Real Time Genomics Limited Software Licence Agreement
 * for Academic Non-commercial Research Purposes only.
 *
 * If you did not receive a license accompanying this file, a copy must first be obtained by email
 * from support@realtimegenomics.com.  On downloading, using and/or continuing to use this source
 * code you accept the terms of that license agreement and any amendments to those terms that may
 * be made from time to time by Real Time Genomics Limited.
 */

public class Main {
    static final int BITS = 24;

    static int doubleToIndex(final double x) {
        final long j = Double.doubleToRawLongBits(x);
        final long k = j >>> (64 - BITS);
        assert k <= Integer.MAX_VALUE;
        return (int) k;
    }
}

Related

  1. doubleToFloatMatrix(double[][] matrix)
  2. doubleToFractionStr(final Double d)
  3. doubleToHashString(double value)
  4. doubleToHexString(double val)
  5. doubleToI18nString(double d)
  6. doubleToLex(double v)
  7. doubleToPercent(double value, int precision)
  8. doubleToRational(double number)
  9. doubleToRegisters(double d)