java sort string alphabetically without using sort method