I don't think that would be a win, since StringBuilder.toString() copies the array into a new String, just like String.substring() does.

Plus:
* Using indexOf() avoids bounds checks on each character.
* Using StringBuilder takes an extra allocation and requires each character to be copied.

But I'm sure things could be sped up quite a bit, e.g. by inlining this method into decodePath, changing decodePathSegment to operate on mutable arrays to avoid copying, etc.