Here you can find the source of ipV4ToInt(String addr)
public static int ipV4ToInt(String addr)
//package com.java2s; /*// w w w . j a v a2 s. c o m Copyright (C) 2011 NTT DATA Corporation This program is free software; you can redistribute it and/or Modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. */ public class Main { public static int ipV4ToInt(String addr) { int[] ary = new int[4]; String[] strAry = addr.split("\\."); for (int i = 0; i < 4; i++) { ary[i] = Integer.parseInt(strAry[i]); } int l = ary[0] << 24; l += ary[1] << 16; l += ary[2] << 8; l += ary[3]; return l; } }