code: public static String bytesToIpAddress(byte[] bytes, int offset, int length) {
          switch (length) {
              case 4: {
                  return new StringBuilder(15)
                          .append(bytes[offset] & 0xff)
                          .append('.')
                          .append(bytes[offset + 1] & 0xff)
                          .append('.')
                          .append(bytes[offset + 2] & 0xff)
                          .append('.')
                          .append(bytes[offset + 3] & 0xff).toString();
              }
              case 16:
                  return toAddressString(bytes, offset, false);
              default:
                  throw new IllegalArgumentException("length: " + length + " (expected: 4 or 16)");
          }
      }
docs: Converts 4-byte or 16-byte data into an IPv4 or IPv6 string respectively.
  
  @throws IllegalArgumentException
  if {@code length} is not {@code 4} nor {@code 16}