Java BigInteger Calculate getNetAddress(BigInteger ip, BigInteger netmask)

Here you can find the source of getNetAddress(BigInteger ip, BigInteger netmask)

Description

Gets the net address.

License

Apache License

Parameter

Parameter Description
ip the ip
netmask the netmask

Return

the net address

Declaration

public static BigInteger getNetAddress(BigInteger ip, BigInteger netmask) 

Method Source Code


//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);
    }
}

Related

  1. getMetaDataForLPortDispatcher(int lportTag, short serviceIndex, BigInteger serviceMetaData)
  2. getMetaDataMaskForLPortDispatcher(BigInteger metadataMaskForServiceIndex, BigInteger metadataMaskForLPortTag, BigInteger metadataMaskForService)
  3. getN(BigInteger p, BigInteger q)
  4. getNafWeight(BigInteger k)
  5. getNatRouterIdFromMetadata(BigInteger metadata)
  6. getNextLexicographicalPermutation(BigInteger v)
  7. getNRightmostBits(final BigInteger in, final int n)
  8. getNumbersBetweenRange(BigInteger minValue, BigInteger maxValue)
  9. getPrivateKey(BigInteger ran, BigInteger publicKey)