List of usage examples for java.net InetAddress hashCode
public int hashCode()
From source file:Main.java
public static void main(String[] argv) throws Exception { byte[] ipAddr = new byte[] { 127, 0, 0, 1 }; InetAddress addr = InetAddress.getByAddress(ipAddr); System.out.println(addr.hashCode()); }
From source file:com.sckftr.android.utils.net.Network.java
/** * Get IP address from first non-localhost interface * @return address or empty string/*from ww w .j av a 2 s.c om*/ */ public static String getLocalIpAddress() { try { for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en .hasMoreElements();) { NetworkInterface intf = en.nextElement(); for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) { InetAddress inetAddress = enumIpAddr.nextElement(); if (!inetAddress.isLoopbackAddress()) { String ip = Formatter.formatIpAddress(inetAddress.hashCode()); Log.i("NET", "***** IP=" + ip); return ip; } } } } catch (SocketException ex) { Log.e("NET", ex.toString()); } return null; }
From source file:com.at.lic.LicenseControl.java
private String getLicenseCheckCode() { String os_arch = getSysProp("os.arch"); // x86 String os_name = getSysProp("os.name"); // Windows XP String os_version = getSysProp("os.version"); // 5.1 String sun_arch_data_model = getSysProp("sun.arch.data.model"); // 32 String user_language = getSysProp("user.language"); // zh String sun_cpu_isalist = getSysProp("sun.cpu.isalist"); // pentium_pro + // mmx//from ww w .j av a 2s.c om // pentium_pro // pentium+mmx // pentium i486 // i386 i86 String mac = null; InetAddress addr = null; try { mac = getMAC(); addr = InetAddress.getLocalHost(); } catch (Exception e) { log.error("Getting information from ethernet card failed.", e); die(); } StringBuilder sb = new StringBuilder(); sb.append(os_arch.hashCode()); sb.append(os_name.hashCode()); sb.append(os_version.hashCode()); sb.append(sun_arch_data_model.hashCode()); sb.append(user_language.hashCode()); sb.append(sun_cpu_isalist.hashCode()); sb.append(mac.hashCode()); sb.append(addr.hashCode()); int licCheckCode = sb.toString().hashCode(); return String.valueOf(licCheckCode); }