Skip to main content

Posts

Showing posts with the label IP Subnet Mask
Calculating IPs with the help of IP Subnet Mask (CIDR Notation ) //Library Required : commons-net-3.0.1.jar package com.pukhraj.blog; import org.apache.commons.net.util.SubnetUtils; public class IPSubnetMask { public static void main(String[] args) { String subnet = "IP/SubnetMask"; SubnetUtils utils = new SubnetUtils(subnet); String lowip = utils.getInfo().getLowAddress(); System.out.println("Low IP "+lowip); String highip = utils.getInfo().getHighAddress(); System.out.println("High IP "+highip); String[] addresses = utils.getInfo().getAllAddresses(); System.out.println("Total IPs : "+addresses.length); System.out.println("isInRange : "+utils.getInfo().isInRange("IP")); } }