Here you can find the source of startsWith(String s1, String s2)
public static boolean startsWith(String s1, String s2)
//package com.java2s; //License from project: Open Source License public class Main { public static boolean startsWith(String s1, String s2) { if (s1 == null) { if (s2 == null) { return true; } else { // return s2.startsWith(s1); return false; }/*from www . j av a 2 s . c o m*/ } else { if (s2 == null) { return false; } else { return s1.startsWith(s2); } } } }