public LibraryClass(int x) {
    bookShelf = new TextBook[x];
    for(int i=0;i<x;i++){
        bookShelf[i] = new TextBook("textbook" + i, 5);
    }
    nextBook = x - 1;  
    }
So this is my code, and whatever input we give the int x, for example 5, the max index would be 4. i could easily yes put a pointer on this position, but is there any other code which gives me the highest index number (NOT the highest element) to me?
 
     
     
     
    