java 生成hash值
程序员文章站
2024-03-22 17:19:28
...
/**
* @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);
}
}
上一篇: String字符串拼接效率比较