Hi,
Why are you thinking that its 1 based?
StringBuilder's insert method uses zero based index.
If we take the above example, the result would be 01hello234.
When we call insert(2,"hello") on str, it inserts "hello" at index 2(means 3rd character).
Refer to the
Java API documentation for more information!