Microsoft interview question

Q: realize substring in Java