Here you can find the source of substring(String source, int size)
public static String substring(String source, int size)
//package com.java2s; //License from project: Apache License public class Main { public static String substring(String source, int size) { return substring(source, 0, size); }//from ww w .j a va 2 s . c om public static String substring(String source, int offset, int size) { if (source == null || size < 1 || offset < 0) { return ""; } if (source.length() <= (offset + size)) { return source; } return source.substring(offset, size); } }