public abstract class NetWorkUtils extends Object
| Constructor and Description |
|---|
NetWorkUtils() |
| Modifier and Type | Method and Description |
|---|---|
static int |
byteArrayHashCode(byte[] bytes) |
static String |
getHostIp(InetAddress netAddress) |
static String |
getHostName() |
static String |
getHostName(InetAddress netAddress) |
static InetAddress |
getInetAddress() |
static long |
getUnsignedInt(int x) |
static String |
getWidthMachineNumber()
获取等宽的机器码,相同的机器每次都是获取相同值
|
static String |
getWidthMachineNumber(int maxWidth)
获取等宽的机器码,相同的机器每次都是获取相同值
|
static void |
main(String[] args) |
static int |
stringHashCode(String string)
Returns a hash code for this string.
|
public static InetAddress getInetAddress() throws UnknownHostException
UnknownHostExceptionpublic static String getHostIp(InetAddress netAddress)
public static String getWidthMachineNumber() throws UnknownHostException
UnknownHostExceptionpublic static String getWidthMachineNumber(int maxWidth) throws UnknownHostException
UnknownHostExceptionpublic static int stringHashCode(String string)
String object is computed as
usings[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]
int arithmetic, where s[i] is the
ith character of the string, n is the length of
the string, and ^ indicates exponentiation.
(The hash value of the empty string is zero.)public static int byteArrayHashCode(byte[] bytes)
public static String getHostName() throws UnknownHostException
UnknownHostExceptionpublic static String getHostName(InetAddress netAddress)
public static long getUnsignedInt(int x)
public static void main(String[] args) throws IOException
IOExceptionCopyright © 2018. All rights reserved.