public static int compareArray(char[] larray, int lstartIndex, char[] rarray,int rstartIndex) {if (larray == null) {if (rarray == null || rstartIndex >= rarray.length)return 0;elsereturn -1;} else {if (rarray == null) {if (lstartIndex >= larray.length)return 0;elsereturn 1;}}int li = lstartIndex, ri = rstartIndex;while (li < larray.length && ri < rarray.length && larray[li] == rarray[ri]) {li++;ri++;}if (li == larray.length) {if (ri == rarray.length) {return 0;} else {return -1;}} else {if (ri == rarray.length) {return 1;} else {if (larray[li] > rarray[ri])return 1;elsereturn -1;}}}

public static int CompareArray(char[] larray, int lstartIndex, char[] rarray,int rstartIndex){if (larray == null){if (rarray == null || rstartIndex >= rarray.Length)return 0;elsereturn -1;}else{if (rarray == null){if (lstartIndex >= larray.Length)return 0;elsereturn 1;}}int li = lstartIndex, ri = rstartIndex;while (li < larray.Length && ri < rarray.Length && larray[li] == rarray[ri]){li++;ri++;}if (li == larray.Length){if (ri == rarray.Length){return 0;}else{return -1;}}else{if (ri == rarray.Length){return 1;}else{if (larray[li] > rarray[ri])return 1;elsereturn -1;}}}
