Here you can find the source of toDotString(InetAddress ip)
public static String toDotString(InetAddress ip)
//package com.java2s; //License from project: Apache License import java.net.InetAddress; public class Main { public static String toDotString(InetAddress ip) { byte[] bytes = ip.getAddress(); String str = new String(); for (int i = 0; i < 4; i++) { int b = bytes[i]; if (b < 0) b += 256;/* www .j a v a2 s . c o m*/ str += b; if (i < 3) str += "."; } return str; } }