code: private int findOrInsertNodeForPrimary(long p) {
          int rootIndex = binarySearchForRootPrimaryNode(
              rootPrimaryIndexes.getBuffer(), rootPrimaryIndexes.size(), nodes.getBuffer(), p);
          if(rootIndex >= 0) {
              return rootPrimaryIndexes.elementAti(rootIndex);
          } else {
              // Start a new list of nodes with this primary.
              int index = nodes.size();
              nodes.addElement(nodeFromWeight32(p));
              rootPrimaryIndexes.insertElementAt(index, ~rootIndex);
              return index;
          }
      }
docs: Finds or inserts the node for a root CE's primary weight.