IP号码

欢马劈雪     最近更新时间:2020-01-02 10:19:05

413
IP号码
/**
 * 时   代     Java  公  众  号 - nowjava.com 提 供 
**/


import java.util.ArrayList;

import java.util.regex.Pattern;


public class Main{


    public static String numberToIP(long addr)

            throws InvalidIPAddressException {


        if (addr < 0L || addr > 4294967295L) {

            throw new InvalidIPAddressException("Invalid IP");

        }
/**NowJava.com - 时代Java**/

        StringBuilder ip = new StringBuilder();


        ip.append((addr >> 24) & 0xFF).append(".");

        ip.append((addr >> 16) & 0xFF).append(".");

        ip.a
展开阅读全文