@@ -0,0 +1,1329 @@
+/*%0A * Copyright 2012 Takao Nakaguchi%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A * http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.trie4j.patricia.terminletters;%0A%0Apublic class CharsUtil %7B%0A%09public static char%5B%5D newTerminatedChars(char%5B%5D letters)%7B%0A%09%09char%5B%5D l = new char%5Bletters.length + 1%5D;%0A%09%09System.arraycopy(letters, 0, l, 0, l.length - 1);%0A%09%09l%5Bl.length - 1%5D = 0xffff;%0A%09%09return l;%0A%09%7D%0A%0A%09public static char%5B%5D newTerminatedCharsFrom(char%5B%5D org, int from, int to)%7B%0A%09%09char%5B%5D ret = new char%5Bto - from + 1%5D;%0A%09%09System.arraycopy(org,  from, ret, 0, to - from);%0A%09%09ret%5Bret.length - 1%5D = 0xffff;%0A%09%09return ret;%0A%09%7D%0A%0A%09public static char%5B%5D revertWithoutTerminator(char%5B%5D values)%7B%0A%09%09int n = values.length;%0A%09%09if(n %3E 0 && values%5Bn - 1%5D == 0xffff)%7B%0A%09%09%09n--;%0A%09%09%7D%0A%09%09char%5B%5D ret = new char%5Bn%5D;%0A%09%09for(int i = 0; i %3C n; i++)%7B%0A%09%09%09ret%5Bn - i - 1%5D = values%5Bi%5D;%0A%09%09%7D%0A%09%09return ret;%0A%09%7D%0A%7D%0A

add CharsUtil class with methods only used from terminalletters.PatriciaTrie.