当前位置: 首页 > 工具软件 > java-hash > 使用案例 >

java 生成hash值

郎嘉树
2023-12-01
/**
 * @program: javademo
 * @description: hash
 * @author: sunyuhua
 * @create: 2021-11-25 12:37
 **/
public class NewHashTest {
 public static void main(String[] args) {
  NewHashTest NewHashTest=new NewHashTest();
 System.out.println("==="+ NewHashTest.hash("sunyuhua"));
 }

 final int hash(Object k) {
  int h = 0;
  h ^= k.hashCode();
  h ^= (h >>> 20) ^ (h >>> 12);
  return h ^ (h >>> 7) ^ (h >>> 4);
 }

}

 类似资料: