Files
hello-algo/ja/codes/java/chapter_hashing/built_in_hash.java
T
Yudong Jin 7257641e0e Retranslate the complete Japanese online edition from Chinese (#2008)
* Retranslate the complete Japanese online edition from Chinese

* Fit Japanese homepage labels and localize heading permalinks

* Point Japanese contribution instructions to the Japanese preview

* Replace locale conditionals with multilingual UI tables
2026-10-30 02:12:26 +08:00

39 lines
1.2 KiB
Java

/**
* File: built_in_hash.java
* Created Time: 2023-06-21
* Author: krahets ([email protected])
*/
package chapter_hashing;
import utils.*;
import java.util.*;
public class built_in_hash {
public static void main(String[] args) {
int num = 3;
int hashNum = Integer.hashCode(num);
System.out.println("整数 " + num + " のハッシュ値は " + hashNum);
boolean bol = true;
int hashBol = Boolean.hashCode(bol);
System.out.println("真偽値 " + bol + " のハッシュ値は " + hashBol);
double dec = 3.14159;
int hashDec = Double.hashCode(dec);
System.out.println("小数 " + dec + " のハッシュ値は " + hashDec);
String str = "Hello 算法";
int hashStr = str.hashCode();
System.out.println("文字列 " + str + " のハッシュ値は " + hashStr);
Object[] arr = { 12836, "小哈" };
int hashTup = Arrays.hashCode(arr);
System.out.println("配列 " + Arrays.toString(arr) + " のハッシュ値は " + hashTup);
ListNode obj = new ListNode(0);
int hashObj = obj.hashCode();
System.out.println("ノードオブジェクト " + obj + " のハッシュ値は " + hashObj);
}
}