Here you can find the source of substr(String s, int start, int end)
public static String substr(String s, int start, int end)
//package com.java2s; //License from project: Open Source License public class Main { public static String substr(String s, int start, int end) { int length = s.length(); if (start < 0) start += length;/*from w w w .j a v a 2s . c om*/ if (end < start) end += length; end = Math.min(length, end); return s.substring(start, end); } }