I'm trying to do a homework assignment for my Java class. The assignment is to make a method that will run a binary search through an array of strings, and return the position. The teacher told us to assume the elements of the array were in ascending order. This means the lexicographic number of each word increases towards the end of the array. For testing if it works, I used:
String[] names = {"H", "He", "Hel", "Hell",
"Hello", "Hello ", "Hello S", "Hello Si",
"Hello Sir", "Hello Sir."};
`I need to find out what the lexicographic number is of a string. Is there a pre-made method I could use for that, or do I have to make my own one to calculate it for me? If it turns out I will have to make my own, I will just put it down underneath this text, for other people to use.