Java tutorial
//package com.java2s; //License from project: Apache License public class Main { public static int ipStringToInt(String ip) { String[] arrStrings = ip.split("\\."); int r = (Integer.parseInt(arrStrings[0]) << 24) | (Integer.parseInt(arrStrings[1]) << 16) | (Integer.parseInt(arrStrings[2]) << 8) | Integer.parseInt(arrStrings[3]); return r; } }