Here you can find the source of ipToInteger(String ip)
public static int ipToInteger(String ip)
//package com.java2s; //License from project: Open Source License public class Main { public static int ipToInteger(String ip) { final String[] ipBytesStr = ip.split("\\."); int ipValue = 0; for (int i = 0; i < 4; i++) { ipValue <<= 8;/*from ww w . ja v a2 s .co m*/ ipValue |= Integer.parseInt(ipBytesStr[i]); } return ipValue; } }