docs: public byte[] compileBranchId() {
      if (tree_id < 1 || tree_id > 65535) {
        throw new IllegalArgumentException("Missing or invalid tree ID");
      }
      // root branch path may be empty
      if (path == null) {
        throw new IllegalArgumentException("Missing branch path");
      }
      if (display_name == null || display_name.isEmpty()) {
        throw new IllegalArgumentException("Missing display name");
      }
      
      // first, make sure the display name is at the tip of the tree set
      if (path.isEmpty()) {
        path.put(0, display_name);
      } else if (!path.lastEntry().getValue().equals(display_name)) {
        final int depth = path.lastEntry().getKey() + 1;
        path.put(depth, display_name);
      }
      
      final byte[] branch_id = new byte[Tree.TREE_ID_WIDTH() + 
                                        ((path.size() - 1) * INT_WIDTH)];
      int index = 0;
      final byte[] tree_bytes = Tree.idToBytes(tree_id);
      System.arraycopy(tree_bytes, 0, branch_id, index, tree_bytes.length);
      index += tree_bytes.length;
      
      for (Map.Entry<Integer, String> entry : path.entrySet()) {
        // skip the root, keeps the row keys 4 bytes shorter
        if (entry.getKey() == 0) {
          continue;
        }
        
        final byte[] hash = Bytes.fromInt(entry.getValue().hashCode());
        System.arraycopy(hash, 0, branch_id, index, hash.length);
        index += hash.length;
      }
      
      return branch_id;
    }