Afraid I don't think it will. The way compareTo() seems to work with Strings is that it subtracts the numbers of the first letters or characters which differ. Find an ASCII chart and you will see that, A=41, B= 42, C=43, D=44 . . . m=6d . . . r=72, z=7a. (All numbers in hex.) SO: "Campbell".compareTo("David") should return 1 because 'D' - 'C' is 44 - 43 is 1. "Campbell".compareTo("Carol") should return 'r' - 'm' = 72 - 6d = 5. This does not however distinguish differences at the first position and third position, so I don't think compareTo() actually tells you what you are looking for.