只需调用hashCode()该String对象:
String s = "Hello World";
System.out.println(s.hashCode());
Run Code Online (Sandbox Code Playgroud)
如果你想要它的格式相同Object.toString(),试试这个:
System.out.println(Integer.toHexString(s.hashCode()));
Run Code Online (Sandbox Code Playgroud)