MCPcopy Create free account
hub / github.com/antlr/codebuff / decrement

Method decrement

output/java_guava/1.4.18/InetAddresses.java:962–972  ·  view source on GitHub ↗

Returns a new InetAddress that is one less than the passed in address. This method works for both IPv4 and IPv6 addresses. @param address the InetAddress to decrement @return a new InetAddress that is one less than the passed in address @throws IllegalArgumentException if InetAddress is at the begi

(InetAddress address)

Source from the content-addressed store, hash-verified

960
961
962 public static InetAddress decrement(InetAddress address) {
963 byte[] addr = address.getAddress();
964 int i = addr.length - 1;
965 while (i >= 0 && addr[i] == (byte) 0x00) {
966 addr[i] = (byte) 0xff;
967 i--;
968 }
969 Preconditions.checkArgument(i >= 0, "Decrementing %s would wrap.", address);
970 addr[i]--;
971 return bytesToInetAddress(addr);
972 }
973
974 /**
975 * Returns a new InetAddress that is one more than the passed in address. This method works for

Callers

nothing calls this directly

Calls 2

checkArgumentMethod · 0.95
bytesToInetAddressMethod · 0.95

Tested by

no test coverage detected