hash Long value - Java java.lang

Java examples for java.lang:long

Description

hash Long value

Demo Code

/*******************************************************************************
 * Copyright (C) 2013, 2015 Swirly Cloud Limited. All rights reserved.
 *******************************************************************************/
//package com.java2s;

public class Main {
    public static void main(String[] argv) {
        long id = 42;
        System.out.println(hashLong(id));
    }//from w w  w .  j  ava2s  .  c o  m

    public static int hashLong(long id) {
        return (int) (id ^ id >>> 32);
    }
}

Related Tutorials