Here you can find the source of ip2long(String ip)
public static Long ip2long(String ip)
//package com.java2s; public class Main { public static Long ip2long(String ip) { String[] arrStr = ip.split("\\."); if (arrStr.length != 4) throw new IllegalArgumentException("Wrong IP address"); Long longIP = Long.parseLong(arrStr[0]) * 256 * 256 * 256 + Long.parseLong(arrStr[1]) * 256 * 256 + Long.parseLong(arrStr[2]) * 256 + Long.parseLong(arrStr[3]); return longIP; }/* w w w. jav a 2 s . co m*/ }