Here you can find the source of intToIpAddr(int ip)
Parameter | Description |
---|---|
ip | A quad-dotted notation string, e.g. "192.168.5.25" |
public static String intToIpAddr(int ip)
//package com.java2s; //License from project: Open Source License public class Main { /**// w w w . j a v a 2 s.c o m * @param ip A quad-dotted notation string, e.g. "192.168.5.25" * @return String */ public static String intToIpAddr(int ip) { return "" + String.valueOf((ip) >>> 24) + "." + String.valueOf((ip & 0x00FFFFFF) >>> 16) + "." + String.valueOf((ip & 0x0000FFFF) >>> 8) + "." + String.valueOf(ip & 0x000000FF); } }