Well, without seeing the code .... and my crystal ball was stolen by an evil wizard :-)
mmm. typecasting galore. personally, i'd keep the sorting functionality to a sort method and not put it in the add method. but if that's your specs, then i guess it's what you should be doing.
well, if your compareTo method is saying that 3 < 98, then you implemented it wrong.
i meant 3 > 98 obviously, but anyways, no idea what your compareTo method does. you only posted your add method.
OK, that'll be the problem then... Suggest you read the documentation of String.compareTo() to see what it actually does, and then see if that's what you wanted.