Here you can find the source of convertIp(String ip)
public static String convertIp(String ip)
//package com.java2s; //License from project: Apache License public class Main { public static String convertIp(String ip) { String[] iplist = ip.split("\\."); int ip0 = Integer.parseInt(iplist[0]); int ip1 = Integer.parseInt(iplist[1]); int ip2 = Integer.parseInt(iplist[2]); int ip3 = Integer.parseInt(iplist[3]); String result = Integer.toHexString((ip0 << 24) + (ip1 << 16) + (ip2 << 8) + ip3); for (int i = result.length(); i < 8; i++) { result = '0' + result; }//from w w w .ja v a 2s. co m return result; } }