Here you can find the source of getNetAddress(BigInteger ip, BigInteger netmask)
Parameter | Description |
---|---|
ip | the ip |
netmask | the netmask |
public static BigInteger getNetAddress(BigInteger ip, BigInteger netmask)
//package com.java2s; //License from project: Apache License import java.math.BigInteger; public class Main { /** 128 bit bitmask. */ private static BigInteger BITMASK_IPV6 = new BigInteger(new byte[] { 0x1, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff, (byte) 0xff }); /**//from w w w . j av a 2s . c om * Gets the net address. * * @param ip * the ip * @param netmask * the netmask * @return the net address */ public static BigInteger getNetAddress(BigInteger ip, BigInteger netmask) { return ip.and(netmask).and(BITMASK_IPV6); } }