Sorting on length with identification of number of characters

view story

http://www.unix.com – Hello, I am writing an open-source stemmer in Java for Indic languages which admit a large number of suffixes. The Java stemmer requires that each suffix string be sorted as per its length and that all strings of the same length are arranged in a single group, sorted alphabetically. Moreover as a header I need to specify the numeric value of the string, say Quote: 5 6 7 8 etc. Since the languages in question have over 300 and more suffixes, trying to sort on length and identifying the length of each string and counting it becomes a diffi (HowTos)