Files
hello-algo/ja/codes/java/chapter_hashing/built_in_hash.java
Yudong Jin d7b2277d2b Re-translate the Japanese version (#1871)
* Retranslate Japanese docs with GPT-5.4

* Retranslate Japanese code with GPT-5.4
2026-03-30 07:30:15 +08:00

39 lines
1.2 KiB
Java

/**
* File: built_in_hash.java
* Created Time: 2023-06-21
* Author: krahets (krahets@163.com)
*/
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);
}
}