I am getting the following error when calling a function from within my class:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
Although I used a sys
I think you need to change the looping condition which is the problem here. You are looping one more iteration when you do <=size and the index starts from i=0. You can change this
for(int i=0; i<=size; i++)
to
for(int i=0; i
and also take care about the inner loop condition.