Java Int64 Convert int64toInt32(long key)

Here you can find the source of int64toInt32(long key)

Description

Hashes a long to an int

License

Open Source License

Declaration

public static int int64toInt32(long key) 

Method Source Code

//package com.java2s;
// it under the terms of the GNU Lesser General Public License as published by

public class Main {
    /**//from   ww  w.  j  av a2  s  .  c om
     * Hashes a long to an int
     */
    public static int int64toInt32(long key) {
        key = (~key) + (key << 18);
        key = key ^ (key >>> 31);
        key = key * 21;
        key = key ^ (key >>> 11);
        key = key + (key << 6);
        key = key ^ (key >>> 22);
        return (int) key;
    }
}

Related

  1. int64(Object value)
  2. Int642Bytes(long sour)
  3. int64_to_buf(byte buf[], int pos, long value)
  4. int64d(byte[] buf, int off)
  5. int64ToByteArray(long value, int size)