Here you can find the source of substring(String text, int begin, int end)
public static String substring(String text, int begin, int end)
//package com.java2s; //License from project: Open Source License public class Main { public static String substring(String text, int begin, int end) { return text.substring(Math.min(text.length(), begin), Math.min(text.length(), end)); }/*from www . j a va2s .c o m*/ }