code: private void addAddressToList(String newAddress, boolean validateOnly) {
          int start = 0;
          char delimiter = '.';
          String sub;
          int radix = 10;
  
          // Address initially set to all zeroes
          int addressToAdd[] = new int[IP_ADDR_NUMBERS];
          for (int i = 0; i < IP_ADDR_NUMBERS; i++) {
              addressToAdd[i] = 0;
          }
  
          int slot = IP_ADDR_NUMBERS - 1;
          // assume the address is IP4, but change to IP6 if there is a colon
          if (newAddress.indexOf('.') == -1) {
              // if no ".", then assume IPv6 Address
              delimiter = ':';
              radix = 16;
          }
  
          String addr = newAddress;
          while (true) {
              // fill address from back to front
              start = addr.lastIndexOf(delimiter);
              if (start != -1) {
                  sub = addr.substring(start + 1);
  
                  if (sub.trim().equals("*")) {
                      addressToAdd[slot] = -1; // 0xFFFFFFFF is the wildcard.
                  } else {
                      addressToAdd[slot] = Integer.parseInt(sub, radix);
                  }
              } else {
                  if (addr.trim().equals("*")) {
                      addressToAdd[slot] = -1; // 0xFFFFFFFF is the wildcard.
                  } else {
                      addressToAdd[slot] = Integer.parseInt(addr, radix);
                  }
                  break;
              }
              slot = slot - 1;
              addr = addr.substring(0, start);
          }
  
          if (!validateOnly) {
              putInList(addressToAdd);
          }
      }
docs: Add one IPv4 or IPv6 address to the tree. The address is passed in as
  a string and converted to an integer array by this routine. Another method
  is then called to put it into the tree
  
  @param newAddress
  address to add