public static int compareArrayByPrefix(char[] shortArray, int shortIndex,char[] longArray, int longIndex) {if (shortArray == null)return 0;else if (longArray == null)return (shortIndex < shortArray.length) ? 1 : 0;int si = shortIndex, li = longIndex;while (si < shortArray.length && li < longArray.length&& shortArray[si] == longArray[li]) {si++;li++;}if (si == shortArray.length) {return 0;} else {if (li == longArray.length)return 1;elsereturn (shortArray[si] > longArray[li]) ? 1 : -1;}}

public static int CompareArrayByPrefix(char[] shortArray, int shortIndex,char[] longArray, int longIndex){if (shortArray == null)return 0;else if (longArray == null)return (shortIndex < shortArray.Length) ? 1 : 0;int si = shortIndex, li = longIndex;while (si < shortArray.Length && li < longArray.Length&& shortArray[si] == longArray[li]){si++;li++;}if (si == shortArray.Length){return 0;}else{if (li == longArray.Length)return 1;elsereturn (shortArray[si] > longArray[li]) ? 1 : -1;}}
