Here you can find the source of ipToInt(String addr)
public static Long ipToInt(String addr)
//package com.java2s; //License from project: Open Source License public class Main { public static Long ipToInt(String addr) { String[] addrArray = addr.split("\\."); long num = 0; for (int i = 0; i < addrArray.length; i++) { int power = 3 - i; num += ((Integer.parseInt(addrArray[i]) % 256 * Math.pow(256, power))); }//w w w . j a v a 2 s. c om return num; } }