NetworkInterface hashCode Example
NetworkInterface class hashCode example. This example shows you how to use hashCode method.
NetworkInterface class hashCode example. public int hashCode() Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided by java.util.Hashtable.
Here is the code
/*
* @ # HashCode.java
* A class repersenting use to HashCode method
* of URL class in java.net package
* version 23 June 2008
* author Rose India
*/
import java.net.*;
public class HashCode {
public static void main(String args[]) throws Exception {
byte b[] = {127, 0, 0, 1};
InetAddress inetAddress = InetAddress.getByAddress(b);
NetworkInterface networkInterface =
NetworkInterface.getByInetAddress(inetAddress);
System.out.println("Hash code : " + inetAddress.hashCode());
}
} |
|