| 851 | |
| 852 | // returns lo | hi network address in a single long |
| 853 | public static long getBroadcastAddress(CharSequence sequence) throws NumericException { |
| 854 | long subnetAndNetmask = Numbers.getIPv4Subnet(sequence); |
| 855 | int subnet = (int) (subnetAndNetmask >> 32); |
| 856 | int netmask = (int) (subnetAndNetmask); |
| 857 | // sets all remaining bits to the right of the subnet |
| 858 | int broadcastAddress = subnet | ~(0xffffffff << (32 - getNetmaskLength(netmask))); |
| 859 | |
| 860 | return pack(subnet & netmask, broadcastAddress); |
| 861 | } |
| 862 | |
| 863 | // returns network mask, e.g. 255.0.0.0 == /8 or Numbers.BAD_NETMASK on error |
| 864 | public static int getIPv4Netmask(CharSequence sequence) { |