Java has a lot of experience in this department. So much so, that they decided to replace the implementation of .substring():
.substring()