int (@NonNls String key, int prefixOffset, int nodeOffset) { if (prefixOffset == key.length()) return nodeOffset; int children = myData[nodeOffset + 2]; for (int c = 0; c < children; c++) { int child = myData[nodeOffset + 3 + c]; int childCharsFrom = myData[child], childCharsTo = myData[child + 1]; int i, limit = Math.min(key.length() - prefixOffset, childCharsTo - childCharsFrom); for (i = 0; i < limit; i++) { if (key.charAt(prefixOffset + i) != myChars.charAt(childCharsFrom + i)) break; } if (i == childCharsTo - childCharsFrom) return findNodeForPrefix(key, prefixOffset + i, child); if (i == key.length() - prefixOffset) return child; if (i > 0) return -1; } return -1; }