Here you can find the source of substring(String str, int start)
public static String substring(String str, int start)
//package com.java2s; //License from project: Apache License public class Main { private static final String EMPTY = ""; public static String substring(String str, int start) { if (str == null) { return null; }//from w w w.ja va 2 s.c om // handle negatives, which means last n characters if (start < 0) { start = str.length() + start; // remember start is negative } if (start < 0) { start = 0; } if (start > str.length()) { return EMPTY; } return str.substring(start); } }