Here you can find the source of substring(String S, int beginIndex, int endIndex)
public static String substring(String S, int beginIndex, int endIndex)
//package com.java2s; //License from project: LGPL public class Main { public static String substring(String S, int beginIndex, int endIndex) { if (beginIndex < endIndex && beginIndex >= 0 && endIndex <= S.length()) { return S.substring(beginIndex, endIndex); } else {//from w ww .j a v a 2 s . c o m return ""; } } public static String substring(String S, int beginIndex) { return substring(S, beginIndex, S.length()); } }