Here you can find the source of IP2Int(String ip)
private static int IP2Int(String ip)
//package com.java2s; //License from project: Open Source License public class Main { /**/* w w w . j a va2s. c o m*/ * Converter IP to integer */ private static int IP2Int(String ip) { String ipString = ""; int part; String parts[] = ip.split("\\."); for (int i = 0; i < parts.length; i++) { part = Integer.parseInt(parts[i]); parts[i] = Integer.toHexString(0x100 | part).substring(1); ipString = ipString + parts[i]; } int ipInt = Integer.parseInt(ipString, 16); return ipInt; } }