public class IPUtil {
 
 
 public static int IPToInt(String ipAddress)
 {
  String[]   ipqi_ary=ipAddress.split("\\.");    
  int ip0= new Integer(ipqi_ary[0]).intValue();
  int ip1= new Integer(ipqi_ary[1]).intValue();
  int ip2= new Integer(ipqi_ary[2]).intValue();
  int ip3= new Integer(ipqi_ary[3]).intValue();
     return ip0*256*256*256+ip1*256*256+ip2*256+ip3;
 }

 public static String IntToIP(int ipAddress)
 {
     long ui1 = ipAddress & 0xFF000000;
  ui1 = ui1 >> 24;
  long ui2 = ipAddress & 0x00FF0000;
  ui2 = ui2 >> 16;
  long ui3 = ipAddress & 0x0000FF00;
  ui3 = ui3 >> 8;
  long ui4 = ipAddress & 0x000000FF;
  String IPstr = "";
  IPstr = String.valueOf(ui1) + "." + String.valueOf(ui2) + "."
    + String.valueOf(ui3) + "." + String.valueOf(ui4);
  return IPstr;
 }

 public static void  main(String args[]){
  
  String ipAddress="58.17.128.0";
  
  int ipInt=IPUtil.IPToInt(ipAddress);
  
  System.out.println("String to int :"+ipInt);
  
  System.out.println("int to String :"+IPUtil.IntToIP(ipInt));
 }
 
}



------君临天下,舍我其谁------