Dmitry Dmitry - 1 year ago 98
Java Question

Converting CIDR address to subnet mask and network address

Given a CIDR address, e.g.

  • How to determine mask length? (

  • How to determine mask address? (

  • How to determine network address? (

Answer Source

It is covered by apache utils.

See this URL:

String subnet = "";
SubnetUtils utils = new SubnetUtils(subnet);


Note: For use w/ /32 CIDR subnets, for exemple, one needs to add the following declaration :

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download