@Test public void testGetMaskFromPrefix_Correct () { int result = NetUtils.getMaskFromPrefix(IPV4_ADDRESS_1 + MASK_24); Assert.assertEquals(24, result); }
public static int getMaskFromPrefix(@Nullable String prefix) { String newPrefix = Strings.nullToEmpty(prefix); int slashIndex = newPrefix.indexOf("/"); if (slashIndex == -1) { slashIndex = newPrefix.length() - 1; } return Integer.parseInt(newPrefix.substring(slashIndex + 1)); }
NetUtils { public static int getMaskFromPrefix(@Nullable String prefix) { String newPrefix = Strings.nullToEmpty(prefix); int slashIndex = newPrefix.indexOf("/"); if (slashIndex == -1) { slashIndex = newPrefix.length() - 1; } return Integer.parseInt(newPrefix.substring(slashIndex + 1)); } }
NetUtils { public static int getMaskFromPrefix(@Nullable String prefix) { String newPrefix = Strings.nullToEmpty(prefix); int slashIndex = newPrefix.indexOf("/"); if (slashIndex == -1) { slashIndex = newPrefix.length() - 1; } return Integer.parseInt(newPrefix.substring(slashIndex + 1)); }  }
NetUtils { public static int getMaskFromPrefix(@Nullable String prefix) { String newPrefix = Strings.nullToEmpty(prefix); int slashIndex = newPrefix.indexOf("/"); if (slashIndex == -1) { slashIndex = newPrefix.length() - 1; } return Integer.parseInt(newPrefix.substring(slashIndex + 1)); }  static int getMaskFromPrefix(@Nullable String prefix); static @Nonnull String getIpAddrFromPrefix(@Nullable String prefix); static @Nullable Ipv6Address applyMaskOnIpv6Prefix(@Nullable Ipv6Prefix ipv6Prefix, int ipv6MaskLength); static @Nullable Ipv6Address applyMaskOnIpv6Address(@Nullable Ipv6Address ipv6Address, int ipv6MaskLength); static boolean samePrefix(@Nullable IpPrefix prefix1, @Nullable IpPrefix prefix2); static boolean isInRange(@Nullable IpPrefix prefix, @Nullable String ipAddress); }
NetUtils { public static int getMaskFromPrefix(@Nullable String prefix) { String newPrefix = Strings.nullToEmpty(prefix); int slashIndex = newPrefix.indexOf("/"); if (slashIndex == -1) { slashIndex = newPrefix.length() - 1; } return Integer.parseInt(newPrefix.substring(slashIndex + 1)); }  static int getMaskFromPrefix(@Nullable String prefix); static @Nonnull String getIpAddrFromPrefix(@Nullable String prefix); static @Nullable Ipv6Address applyMaskOnIpv6Prefix(@Nullable Ipv6Prefix ipv6Prefix, int ipv6MaskLength); static @Nullable Ipv6Address applyMaskOnIpv6Address(@Nullable Ipv6Address ipv6Address, int ipv6MaskLength); static boolean samePrefix(@Nullable IpPrefix prefix1, @Nullable IpPrefix prefix2); static boolean isInRange(@Nullable IpPrefix prefix, @Nullable String ipAddress);  }